Cuboid

Description

struct Tinman.Core.Math.Cuboid

A cuboid.

The vertices of the cuboid are defined as follows, based on the unit cube:

   2-------6                c0 := (0, 0, 0)
  /.      /|      Y+        c1 := (0, 0, 1)
 / .     / |      |         c2 := (0, 1, 0)
3-------7  |      +-- X+    c3 := (0, 1, 1)
|  0....|..4     /          c4 := (1, 0, 0)
| .     | /     Z+          c5 := (1, 0, 1)
|.      |/                  c6 := (1, 1, 0)
1-------5                   c7 := (1, 1, 1)

where the transformation of a point A in unit cube space and a point B in world-space is defined as this:

A' = Orientation * A + Origin
B' = Orientation' * (B - Origin)

where A' and B' are the transformed points in world-space resp. unit cube space, and Orientation' is the transpose of Orientation.

Public / Constants

Unit


public static readonly attribute Unit → (Cuboid)

The unit cube.

Public / Constructors

Cuboid


public constructor Cuboid → (2)

origin in : Vec3D

Origin of the unit cube, in world-space.

orientation in : Mat3D

Affine matrix that transforms from the unit cube to world-space.

Creates a new instance of Cuboid.

FromMatrix


[Pure]
public static method FromMatrix → (1)

matrix in : Mat4D

A matrix that transforms from the unit cube to world-space.

returns → Cuboid

The Cuboid value.

Creates a new instance of Cuboid.

See also

Cuboid.ToMatrix

FromPoints


[Pure]
public static method FromPoints → (4)

v0 in : Vec3D

Coordinates of corner vertex c0 (origin, see remarks).

v4 in : Vec3D

Coordinates of corner vertex c4 (X-axis, see remarks).

v2 in : Vec3D

Coordinates of corner vertex c2 (Y-axis, see remarks).

v1 in : Vec3D

Coordinates of corner vertex c1 (Z-axis, see remarks).

returns → Cuboid

The Cuboid value.

Creates a new instance of Cuboid.

See also

Cuboid.ToPoint

Public / Methods

RangeZ


[Pure]
public method RangeZ → (2)

in : Vec3D

The ray origin.

in : Vec3D

The unit-length ray direction vector.

returns → RangeD

The Z-range.

Returns the Z-range of this cuboid along the given ray.

ToMatrix


[Pure]
public method ToMatrix → ()

returns → Mat4D

The transformation matrix.

Returns a matrix that transforms from the unit cube to world-space.

ToPoint


[Pure]
public method ToPoint → (1)

in : int32

The corner vertex (see remarks).

returns → Vec3D

The world-space coordinates of the corner vertex.

Returns the world-space coordinates of the given cuboid corner vertex.

Transform


[Pure]
public method Transform → (1)

matrix in : Mat4D

The transformation matrix.

returns → Cuboid

The transformed cuboid.

Transforms this cuboid.

Public / Attributes

Orientation


public readonly attribute Orientation → (Mat3D)

The matrix that transforms from the unit cube to world-space.

Origin


public readonly attribute Origin → (Vec3D)

Origin of the unit cube, in world-space.

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<Cuboid>)

The serialization helper object for values of Cuboid.