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

interface IModelCollider in Tinman.Engine.Models

Base interface for classes that represent the spatial properties of an IModel.

interface IModelCollider extends ISpatialBounds
  ISpatialQuery

Attributes

Box

Returns the axis-aligned bounding box of the model.

property Box { get }
type Box3D
value The bounding box, in model-space.
inherited ISpatialBounds.Box

Mass

Returns the center of mass of the model.

property Mass { get }
type Vec3D
value The weight of mass, in model-space.
inherited ISpatialBounds.Mass

Remarks:

The center of mass is computed from the weighted sum of those model vertices that are used by primitives, with the following weights being assigned to each vertex:

Sphere

Returns the bounding sphere of the model.

property Sphere { get }
type Sphere
value The bounding sphere, in model-space.
inherited ISpatialBounds.Sphere

Methods

DistanceTo

Computes the smallest distance from the given point to the model surface.

method DistanceTo (Vec3D point, float64 nearest = Maths.MaxDouble)
type float64
params point A point, in model-space.
  nearest The maximum distance value to return. Defaults to MaxDouble.
returns [>=0] The smallest distance.
inherited ISpatialQuery.DistanceTo

Octree

Returns the octree of this model collider.

method Octree (int32 which = 0)
type SpatialTreeNode<Box3D>
params which Chooses which octree to return:
0: triangles if existent, otherwise lines if existent, otherwise points
1: points
2: lines
3: triangles
returns The root node of the spatial octree or invalid if none.

See also:

SpatialTreeNode.IsInvalid

PickRay

Picks the point on the model surface that intersects with the given ray.

method PickRay (Ray ray, out Vec3D point, out Vec3D normal, float64 nearest = Maths.MaxDouble)
type bool
params ray The ray.
  point Output for picked point on the model surface.
  normal The model surface normal vector at the picked point.
  nearest The maximum distance value to return. Defaults to MaxDouble.
returns true if a point has been picked,
false if the ray does not intersect with the model surface.
inherited ISpatialQuery.PickRay

Remarks:

If there are multiple intersection points, the nearest one to Origin is returned.

Pose

Returns a model collider for the given model pose.

method Pose (ModelPose pose)
type IModelCollider
params pose The model pose or null for none.
returns [not-null] The resulting model collider.

Save

Returns a ISerializable object that represents the precomputed spatial data structures of this model collider.

method Save ()
type ISerializable
returns The precomputed spatial data structures of this model collider or null if this model collider does not have any precomputed spatial data structures.

Remarks:

Calling this method does not trigger additional computations, the existing spatial data structures are only wrapped in an object and returned.

See also:

IModel.ColliderLoad

Vertices

Returns the vertices that are present in the octree of this model collider.

method Vertices (int32 which = 0)
type IArrayVector<Vec3D>
params which Chooses which octree vertices to return:
0: triangles if existent, otherwise lines if existent, otherwise points
1: points
2: lines
3: triangles
returns [not-null] The vertices.