TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

struct Cuboid in Tinman.Core.Math

A cuboid.

struct Cuboid  

Remarks

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.

Serialization

Serializer

The serialization helper object for values of Cuboid.

public static readonly field Serializer
type ITypeSerializer<Cuboid>

Public / Constants

Unit

The unit cube.

public static readonly field Unit
type Cuboid

Public / Attributes

Orientation

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

public readonly field Orientation
type Mat3D

Origin

Origin of the unit cube, in world-space.

public readonly field Origin
type Vec3D

Public / Constructors

Cuboid

Creates a new instance of Cuboid.

public constructor Cuboid (Vec3D origin, Mat3D orientation)
params origin Origin of the unit cube, in world-space.
  orientation Affine matrix that transforms from the unit cube to world-space.

FromMatrix

Creates a new instance of Cuboid.

[Pure]
public static method FromMatrix (Mat4D matrix)
type Cuboid
params matrix A matrix that transforms from the unit cube to world-space.

See also:

ToMatrix

FromPoints

Creates a new instance of Cuboid.

[Pure]
public static method FromPoints (Vec3D v0, Vec3D v4, Vec3D v2, Vec3D v1)
type Cuboid
params v0 Coordinates of corner vertex c0 (origin, see remarks).
  v4 Coordinates of corner vertex c4 (X-axis, see remarks).
  v2 Coordinates of corner vertex c2 (Y-axis, see remarks).
  v1 Coordinates of corner vertex c1 (Z-axis, see remarks).

See also:

ToPoint

Public / Methods

RangeZ

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

[Pure]
public method RangeZ (Vec3D p, Vec3D v)
type RangeD
params p The ray origin.
  v The unit-length ray direction vector.
returns The Z-range.

ToMatrix

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

[Pure]
public method ToMatrix ()
type Mat4D
returns The transformation matrix.

See also:

FromMatrix

ToPoint

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

[Pure]
public method ToPoint (int32 n)
type Vec3D
params n The corner vertex (see remarks).
returns The world-space coordinates of the corner vertex.

See also:

FromPoints

Transform

Transforms this cuboid.

[Pure]
public method Transform (Mat4D matrix)
type Cuboid
params matrix The transformation matrix.
returns The transformed cuboid.