Table of Contents

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

bounds Cuboidd

TransformedCuboidd(Cuboidd, double[])

public TransformedCuboidd(Cuboidd localBounds, double[] transform)

Parameters

localBounds Cuboidd
transform double[]

Properties

BoundsX1

public double BoundsX1 { get; }

Property Value

double

BoundsX2

public double BoundsX2 { get; }

Property Value

double

BoundsY1

public double BoundsY1 { get; }

Property Value

double

BoundsY2

public double BoundsY2 { get; }

Property Value

double

BoundsZ1

public double BoundsZ1 { get; }

Property Value

double

BoundsZ2

public double BoundsZ2 { get; }

Property Value

double

Methods

Clone()

Copies this shape into a new independently reusable instance.

public TransformedCuboidd Clone()

Returns

TransformedCuboidd

GetAABB(Cuboidd)

Writes the conservative axis-aligned bounds into result.

public Cuboidd GetAABB(Cuboidd result)

Parameters

result Cuboidd

Returns

Cuboidd

GetCenter(Vec3d)

Writes the transformed center into result.

public Vec3d GetCenter(Vec3d result)

Parameters

result Vec3d

Returns

Vec3d

GetHalfAxisX(Vec3d)

Writes the transformed half-axis corresponding to the local X axis.

public Vec3d GetHalfAxisX(Vec3d result)

Parameters

result Vec3d

Returns

Vec3d

GetHalfAxisY(Vec3d)

Writes the transformed half-axis corresponding to the local Y axis.

public Vec3d GetHalfAxisY(Vec3d result)

Parameters

result Vec3d

Returns

Vec3d

GetHalfAxisZ(Vec3d)

Writes the transformed half-axis corresponding to the local Z axis.

public Vec3d GetHalfAxisZ(Vec3d result)

Parameters

result Vec3d

Returns

Vec3d

Intersects(double, double, double, double, double, double)

public bool Intersects(double x1, double y1, double z1, double x2, double y2, double z2)

Parameters

x1 double
y1 double
z1 double
x2 double
y2 double
z2 double

Returns

bool

Intersects(Cuboidd)

public bool Intersects(Cuboidd other)

Parameters

other Cuboidd

Returns

bool

Intersects(TransformedCuboidd)

public bool Intersects(TransformedCuboidd other)

Parameters

other TransformedCuboidd

Returns

bool

IntersectsOrTouches(double, double, double, double, double, double)

public bool IntersectsOrTouches(double x1, double y1, double z1, double x2, double y2, double z2)

Parameters

x1 double
y1 double
z1 double
x2 double
y2 double
z2 double

Returns

bool

IntersectsOrTouches(Cuboidd)

public bool IntersectsOrTouches(Cuboidd other)

Parameters

other Cuboidd

Returns

bool

IntersectsOrTouches(TransformedCuboidd)

public bool IntersectsOrTouches(TransformedCuboidd other)

Parameters

other TransformedCuboidd

Returns

bool

Set(Cuboidd)

Sets this shape to an axis-aligned cuboid.

public TransformedCuboidd Set(Cuboidd bounds)

Parameters

bounds Cuboidd

Returns

TransformedCuboidd

Set(Cuboidd, double[])

Transforms local cuboid bounds by a column-major affine matrix.

public TransformedCuboidd Set(Cuboidd localBounds, double[] transform)

Parameters

localBounds Cuboidd
transform double[]

Returns

TransformedCuboidd

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

center Vec3d
halfAxisX Vec3d
halfAxisY Vec3d
halfAxisZ Vec3d

Returns

TransformedCuboidd

ToRotatedCuboidd()

Converts this orthogonal transformed cuboid to a rotated cuboid with the same center and half-axes.

public RotatedCuboidd ToRotatedCuboidd()

Returns

RotatedCuboidd

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

other Cuboidd
maxSeparation double
contact CuboidContact

Returns

bool

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

other Cuboidd
translationX double
translationY double
translationZ double

Returns

bool

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

other TransformedCuboidd
maxSeparation double
contact CuboidContact

Returns

bool

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

other TransformedCuboidd
start FastVec3d
end FastVec3d

Returns

bool

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

other TransformedCuboidd
translationX double
translationY double
translationZ double

Returns

bool

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

movingShape TransformedCuboidd
motionX double
motionY double
motionZ double
collisionFraction double

Returns

bool

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

movingBox Cuboidd
motionX double
motionY double
motionZ double
collisionFraction double

Returns

bool

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

movingBox Cuboidf
motionX double
motionY double
motionZ double
collisionFraction double

Returns

bool

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

movingBox TransformedCuboidd
motionX double
motionY double
motionZ double
collisionFraction double
normal FastVec3d
startedOverlapping bool
includeInitialOverlap bool

Returns

bool