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

struct Box3D in Tinman.Terrain.Util

A three-dimensional bounding box with 64-bit floating-point precision.

struct Box3D implements IEquatable<Box3D>

Remarks

The coordinates refer to infinitesimal points (pixel-is-point semantic).

Public / Attributes

Center

public property Center { get }
type Vec3D
value

Depth

Returns the extends of this box along the Z-axis.

public property Depth { get }
type float64
value The box depth.

Height

Returns the extends of this box along the Y-axis.

public property Height { get }
type float64
value The box height.

IsEmpty

Is this bounding box empty?

public property IsEmpty { get }
type bool
value true if this bounding box is empty, false if not.

Remarks:

The bounding box is empty if its volume is zero.

IsPoint

Is this bounding box a point?

public property IsPoint { get }
type bool
value true if this bounding box is a point, false if not.

Size

Returns the size of this box.

public property Size { get }
type Vec3D
value The box size: The Width is stored in X, the Height in Y, the Depth in Z.

Volume

Returns the volume of this bounding box.

public property Volume { get }
type float64
value The bounding box volume.

Remarks:

The volume will always be 0 when IsEmpty returns true.

Width

Returns the extends of this box along the X-axis.

public property Width { get }
type float64
value The box width.

X1

X-coordinate of minimum corner of bounding box.

public readonly field X1
type float64

X2

X-coordinate of maximum corner of bounding box.

public readonly field X2
type float64

Y1

Y-coordinate of minimum corner of bounding box.

public readonly field Y1
type float64

Y2

Y-coordinate of maximum corner of bounding box.

public readonly field Y2
type float64

Z1

Z-coordinate of minimum corner of bounding box.

public readonly field Z1
type float64

Z2

Z-coordinate of maximum corner of bounding box.

public readonly field Z2
type float64

Public / Constants

Empty

An empty bounding box at the coordinate origin.

public static readonly field Empty
type Box3D

Inverse

An inverse bounding box that can be used as the initial value for computing bounds via subsequent calls to Grow.

public static readonly field Inverse
type Box3D

Max

The largest possible box.

public static readonly field Max
type Box3D

Public / Methods

CheckIntersection

Checks the intersection between this bounding box and the given one.

[Pure]
public method CheckIntersection (Box3D box)
type int32
params box The other bounding box.
returns -1 if the bounding boxes do not overlap, 1 if box fully contains this bounding box and 0 if both bounding boxes overlap without containing each other.

Checks the intersection between this bounding box and the given ray.

[Pure]
public method CheckIntersection (Ray ray, float64 maximum = Maths.MaxDouble)
type bool
params ray The ray.
  maximum The maximum ray distance to check. Defaults to MaxDouble.
returns true if the ray hits this bounding box, false if not.

Clamp

[Pure]
public method Clamp (Vec3D v)
type Vec3D
params v

[Pure]
public method Clamp (float64 x, float64 y, float64 z)
type Vec3D
params x
  y
  z

ComputeOverlap

Computes the overlap of this bounding box and the given one.

[Pure]
public method ComputeOverlap (Box3D box)
type float64
params box Second bounding box.
returns [>=0] The amount of overlap (i.e. the volume of the intersection).

Contains

Checks if this box contains the given point.

[Pure]
public method Contains (Vec3D xyz)
type bool
params xyz The point coordinates.
returns true if this box contains the point, false if not.

Checks if this box contains the given box.

[Pure]
public method Contains (Box3D box)
type bool
params box The other box.
returns true if this box fully contains the given box, false if not.

Checks if this box contains the given point.

[Pure]
public method Contains (float64 x, float64 y, float64 z)
type bool
params x The point X-coordinate.
  y The point Y-coordinate.
  z The point Z-coordinate.
returns true if this box contains the point, false if not.

Disjoint

Checks if this box and the given box are disjoint (i.e. do not intersect).

[Pure]
public method Disjoint (Box3D box)
type bool
params box The other box.
returns true if this box and the given box are disjoint, false if not.

Equals

Compares this object with the given one.

[Pure]
public method Equals (Box3D other)
type bool
params other The object to compare to.
returns true if this object is equal to other, false if not.

FromPoints

Creates a new instance of Box3D from the given corner points.

[Pure]
public static method FromPoints (Vec3D a, Vec3D b)
type Box3D
params a First corner point.
  b Second corner point.
returns The bounding box.

Creates a new instance of Box3D from the given corner points.

[Pure]
public static method FromPoints (float64 x1, float64 y1, float64 z1, float64 x2, float64 y2, float64 z2)
type Box3D
params x1 X-coordinate of first corner point.
  y1 Y-coordinate of first corner point.
  z1 Z-coordinate of first corner point.
  x2 X-coordinate of second corner point.
  y2 Y-coordinate of second corner point.
  z2 Z-coordinate of second corner point.
returns The bounding box.

FromRect

Creates a new instance of Box3D from the given rectangular cuboid.

[Pure]
public static method FromRect (float64 x, float64 y, float64 z, float64 width, float64 height, float64 depth)
type Box3D
params x X-coordinate of top-left-front corner of cuboid.
  y Y-coordinate of top-left-front corner of cuboid.
  z Z-coordinate of top-left-front corner of cuboid.
  width Width of cuboid.
  height Height of cuboid.
  depth Depth of cuboid.
returns The bounding box.

Grow

Enlarges the extends of this box so that it covers the given box.

public method Grow (Box3D box)
type Box3D
params box To other box.
returns The resulting box.

Enlarges the extends of this box so that it covers the given point.

public method Grow (Vec3D v)
type Box3D
params v Coordinates of point to cover (can be NaN).
returns The resulting box.

Enlarges the extends of this box so that it covers the given point.

public method Grow (float64 x, float64 y, float64 z)
type Box3D
params x X-coordinate of point to cover (can be NaN).
  y Y-coordinate of point to cover (can be NaN).
  z Z-coordinate of point to cover (can be NaN).
returns The resulting box.

Intersect

Computes the intersection of the given bounding box and this one.

[Pure]
public method Intersect (Box3D box)
type Box3D
params box The bounding box.
returns The resulting bounding box.

Scale

Scales the coordinates of this bounding box.

[Pure]
public method Scale (float64 factor)
type Box3D
params factor The scale factor.
returns The resulting bounding box.

ToString

[Pure]
public override method ToString ()
type string

Translate

Translates this bounding box.

[Pure]
public method Translate (Vec3D v)
type Box3D
params v The translation vector.
returns The translated bounding box.

Translates this bounding box.

[Pure]
public method Translate (float64 x, float64 y, float64 z)
type Box3D
params x Translation amount along X-axis.
  y Translation amount along Y-axis.
  z Translation amount along Z-axis.
returns The resulting bounding box.

Serialization

Serializer

The serialization helper object for values of Box3D.

public static readonly field Serializer
type ITypeSerializer<Box3D>