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

interface IFrustum in Tinman.Terrain.Meshing

Represents a frustum in terrain-space.

interface IFrustum base of Frustum
  HullFrustum

Attributes

PlaneCount

The number of frustum planes.

property PlaneCount { get }
type int32
value [0..31] The number of frustum planes.

Remarks:

If a frustum has a plane count of zero, it contains all space.

Methods

PlaneAt

Returns the index-th frustum plane.

method PlaneAt (int32 index)
type Plane
params index [0..PlaneCount-1] The frustum plane index.
returns The frustum plane.

Extensions

ClipLineSegment

Clips the given line segment with this frustum.

[Pure]
method ClipLineSegment (ref Vec3D a, ref Vec3D b)
type int32
params a First point of line segment.
  b Second point of line segment.
returns -1 if the line segment lies entirely outside of the frustum.
0 if the line segment lies entirely inside of the frustum.
1 if a has been updated to represent the clipped line segment.
2 if b has been updated to represent the clipped line segment.
3 if a and b have been updated to represent the clipped line segment.

TestCuboid

Tests if the given cuboid lies inside the frustum.

method TestCuboid (Cuboid cuboid, int32 insideMask = 0)
type int32
params cuboid The cuboid.
  insideMask A bitmask indicating for which planes the cuboid is already known to lie completely inside the planes inner half-space: for plane n within [0..PlaneCount-1], the corresponding bit is 2^n. Defaults to 0.
returns The resulting inside mask (with 0x7FFFFFFF indicating that the cuboid fully lies inside the frustum), -1 if the cuboid lies outside the frustum. Any other value indicates that the cuboid intersects with at least one frustum plane.

Remarks:

The current implementation only tests the corner vertices of the cuboid against each frustum plane, which will not detect the case when a cuboid face intersects with the frustum while all its vertices are outside.

TestExtrudedSphere

Tests if the given extruded sphere lies inside the frustum.

[Pure]
method TestExtrudedSphere (Vec3D center, float64 radius, Vec3D extrusion, int32 insideMask = 0)
type int32
params center Coordinates of sphere center.
  radius Radius of sphere.
  extrusion The vector along which to extrude the sphere.
  insideMask A bitmask indicating for which planes the sphere is already known to lie completely inside the planes inner half-space: for plane n within [0..PlaneCount-1], the corresponding bit is 2^n. Defaults to 0.
returns The resulting inside mask (with 0x7FFFFFFF indicating that the sphere fully lies inside the frustum), -1 if the sphere lies outside the frustum. Any other value indicates that the sphere intersects with at least one frustum plane.

TestSphere

Tests if the given sphere lies inside the frustum.

[Pure]
method TestSphere (Sphere sphere, int32 insideMask = 0)
type int32
params sphere The sphere.
  insideMask A bitmask indicating for which planes the sphere is already known to lie completely inside the planes inner half-space: for plane n within [0..PlaneCount-1], the corresponding bit is 2^n. Defaults to 0.
returns The resulting inside mask (with 0x7FFFFFFF indicating that the sphere fully lies inside the frustum), -1 if the sphere lies outside the frustum. Any other value indicates that the sphere intersects with at least one frustum plane.

Tests if the given sphere lies inside the frustum.

[Pure]
method TestSphere (Vec3D center, float64 radius, int32 insideMask = 0)
type int32
params center Coordinates of sphere center.
  radius Radius of sphere.
  insideMask A bitmask indicating for which planes the sphere is already known to lie completely inside the planes inner half-space: for plane n within [0..PlaneCount-1], the corresponding bit is 2^n. Defaults to 0.
returns The resulting inside mask (with 0x7FFFFFFF indicating that the sphere fully lies inside the frustum), -1 if the sphere lies outside the frustum. Any other value indicates that the sphere intersects with at least one frustum plane.