Class TransformedCuboidd
- Namespace
- Vintagestory.API.MathTools
- Assembly
- VintagestoryAPI.dll
A cuboid transformed by an affine matrix. Instances may be reused with Set(Cuboidd, double[]). Open in GitHub
public sealed class TransformedCuboidd
- Inheritance
-
TransformedCuboidd
- Inherited Members
- Extension Methods
Constructors
TransformedCuboidd()
public TransformedCuboidd()
TransformedCuboidd(Cuboidd)
public TransformedCuboidd(Cuboidd bounds)
Parameters
boundsCuboidd
TransformedCuboidd(Cuboidd, double[])
public TransformedCuboidd(Cuboidd localBounds, double[] transform)
Parameters
Properties
BoundsX1
public double BoundsX1 { get; }
Property Value
BoundsX2
public double BoundsX2 { get; }
Property Value
BoundsY1
public double BoundsY1 { get; }
Property Value
BoundsY2
public double BoundsY2 { get; }
Property Value
BoundsZ1
public double BoundsZ1 { get; }
Property Value
BoundsZ2
public double BoundsZ2 { get; }
Property Value
Methods
Clone()
Copies this shape into a new independently reusable instance.
public TransformedCuboidd Clone()
Returns
GetAABB(Cuboidd)
Writes the conservative axis-aligned bounds into result.
public Cuboidd GetAABB(Cuboidd result)
Parameters
resultCuboidd
Returns
GetCenter(Vec3d)
Writes the transformed center into result.
public Vec3d GetCenter(Vec3d result)
Parameters
resultVec3d
Returns
GetHalfAxisX(Vec3d)
Writes the transformed half-axis corresponding to the local X axis.
public Vec3d GetHalfAxisX(Vec3d result)
Parameters
resultVec3d
Returns
GetHalfAxisY(Vec3d)
Writes the transformed half-axis corresponding to the local Y axis.
public Vec3d GetHalfAxisY(Vec3d result)
Parameters
resultVec3d
Returns
GetHalfAxisZ(Vec3d)
Writes the transformed half-axis corresponding to the local Z axis.
public Vec3d GetHalfAxisZ(Vec3d result)
Parameters
resultVec3d
Returns
Intersects(double, double, double, double, double, double)
public bool Intersects(double x1, double y1, double z1, double x2, double y2, double z2)
Parameters
Returns
Intersects(Cuboidd)
public bool Intersects(Cuboidd other)
Parameters
otherCuboidd
Returns
Intersects(TransformedCuboidd)
public bool Intersects(TransformedCuboidd other)
Parameters
otherTransformedCuboidd
Returns
IntersectsOrTouches(double, double, double, double, double, double)
public bool IntersectsOrTouches(double x1, double y1, double z1, double x2, double y2, double z2)
Parameters
Returns
IntersectsOrTouches(Cuboidd)
public bool IntersectsOrTouches(Cuboidd other)
Parameters
otherCuboidd
Returns
IntersectsOrTouches(TransformedCuboidd)
public bool IntersectsOrTouches(TransformedCuboidd other)
Parameters
otherTransformedCuboidd
Returns
Set(Cuboidd)
Sets this shape to an axis-aligned cuboid.
public TransformedCuboidd Set(Cuboidd bounds)
Parameters
boundsCuboidd
Returns
Set(Cuboidd, double[])
Transforms local cuboid bounds by a column-major affine matrix.
public TransformedCuboidd Set(Cuboidd localBounds, double[] transform)
Parameters
Returns
Set(Vec3d, Vec3d, Vec3d, Vec3d)
Sets this shape from its center and three transformed half-axes.
public TransformedCuboidd Set(Vec3d center, Vec3d halfAxisX, Vec3d halfAxisY, Vec3d halfAxisZ)
Parameters
Returns
ToRotatedCuboidd()
Converts this orthogonal transformed cuboid to a rotated cuboid with the same center and half-axes.
public RotatedCuboidd ToRotatedCuboidd()
Returns
TryGetAABBContact(Cuboidd, double, out CuboidContact)
Gets the outward contact normal and signed separation from this cuboid to a nearby axis-aligned cuboid.
public bool TryGetAABBContact(Cuboidd other, double maxSeparation, out CuboidContact contact)
Parameters
otherCuboiddmaxSeparationdoublecontactCuboidContact
Returns
TryGetAABBPenetration(Cuboidd, out double, out double, out double)
Gets the shortest translation which moves an overlapping axis-aligned cuboid out of this shape.
public bool TryGetAABBPenetration(Cuboidd other, out double translationX, out double translationY, out double translationZ)
Parameters
Returns
TryGetContact(TransformedCuboidd, double, out CuboidContact)
Gets the outward contact normal and signed separation from this cuboid to another nearby transformed cuboid.
public bool TryGetContact(TransformedCuboidd other, double maxSeparation, out CuboidContact contact)
Parameters
otherTransformedCuboiddmaxSeparationdoublecontactCuboidContact
Returns
TryGetIntersectionSegment(TransformedCuboidd, out FastVec3d, out FastVec3d)
Returns an edge segment contained in both boxes, including touching and containment. These endpoints describe the current overlap and not the path or time of an impact.
public bool TryGetIntersectionSegment(TransformedCuboidd other, out FastVec3d start, out FastVec3d end)
Parameters
otherTransformedCuboiddstartFastVec3dendFastVec3d
Returns
TryGetPenetration(TransformedCuboidd, out double, out double, out double)
Gets the shortest translation which moves another overlapping transformed cuboid out of this shape.
public bool TryGetPenetration(TransformedCuboidd other, out double translationX, out double translationY, out double translationZ)
Parameters
otherTransformedCuboiddtranslationXdoubletranslationYdoubletranslationZdouble
Returns
TrySweep(TransformedCuboidd, double, double, double, out double)
Finds the first contact while another transformed cuboid translates through this shape without rotating.
An initial strict overlap is left to the caller's depenetration path and returns false.
On success, collisionFraction is at least zero and less than one. Otherwise, it is one.
public bool TrySweep(TransformedCuboidd movingShape, double motionX, double motionY, double motionZ, out double collisionFraction)
Parameters
movingShapeTransformedCuboiddmotionXdoublemotionYdoublemotionZdoublecollisionFractiondouble
Returns
TrySweepAABB(Cuboidd, double, double, double, out double)
Finds the first contact while an axis-aligned cuboid translates through this shape.
An initial strict overlap is left to the caller's depenetration path and returns false.
On success, collisionFraction is at least zero and less than one. Otherwise, it is one.
public bool TrySweepAABB(Cuboidd movingBox, double motionX, double motionY, double motionZ, out double collisionFraction)
Parameters
Returns
TrySweepAABB(Cuboidf, double, double, double, out double)
Finds the first contact while an axis-aligned float cuboid translates through this shape.
An initial strict overlap is left to the caller's depenetration path and returns false.
On success collisionFraction is at least zero and less than one. Otherwise, it is one.
public bool TrySweepAABB(Cuboidf movingBox, double motionX, double motionY, double motionZ, out double collisionFraction)
Parameters
Returns
TrySweepContact(TransformedCuboidd, double, double, double, out double, out FastVec3d, out bool, bool)
Returns continuous translation contact, including the endpoint and optionally initial strict overlap. The normal points from this cuboid toward the moving cuboid. Touching motion away from or along a surface is ignored.
public bool TrySweepContact(TransformedCuboidd movingBox, double motionX, double motionY, double motionZ, out double collisionFraction, out FastVec3d normal, out bool startedOverlapping, bool includeInitialOverlap = true)
Parameters
movingBoxTransformedCuboiddmotionXdoublemotionYdoublemotionZdoublecollisionFractiondoublenormalFastVec3dstartedOverlappingboolincludeInitialOverlapbool