ISpatialQuery

Description

interface Tinman.Engine.Models.ISpatialQuery

Derived from

ISpatialBounds

Extended by

IModelCollider
TerrainModel sealed

Base interface for classes that provide spatial queries.

Public / Methods

Distance​To

2 overloads


public method DistanceTo1 → (3)

point in : Vec3D

A point, given in the local coordinate system of this spatial object.

maximum opt : float64 = Maths.MaxDouble

The maximum distance value to return, even if the actual distance is greater. Smaller values for maximum opt usually benefit performance.

minimum opt : float64 = 0

The minimum distance value to return, even if the actual distance is smaller. Greater values for minimum opt usually benefit performance.

returns → float64

The smallest distance or maximum opt if no smaller distance has been found.

Computes the smallest distance from the given point to the spatial object.

Use Maths.UlpDouble and/or Maths.Ulp to obtain maximum opt / minimum opt values for open interval checks.


public method DistanceTo2 → (6)

other in : ISpatialQuery

[not-null]
The other spatial object.

transform in : AffineTransform

The transformation from this object (first) to the given other in one (second).

maximum opt : float64 = Maths.MaxDouble

The maximum distance value to return, even if the actual distance is greater. Smaller values for maximum opt usually benefit performance. To perform a standard collision test, use Maths.UlpDouble.

minimum opt : float64 = 0

The minimum distance value to return, even if the actual distance is smaller. Greater values for minimum opt usually benefit performance. To perform a standard collision test, use 0.

tolerance opt : float64 = 0

The distance value tolerance to use for. When an implementation processes a spatial entity that produces distance values in the range x+/-tolerance which intersects with [ minimum opt..maximum opt], it may assume that the actual distance value is x-tolerance. Greater values for tolerance opt usually benefit performance. For maximum accuracy, use 0.

callback opt : ISpatialCallback = null

Optional spatial query callback to use.

returns → float64

The smallest distance or maximum opt if no smaller distance has been found.

Computes the smallest distance between the given spatial objects.

The distance query is performed in the coordinate system of this spatial object. The given transform in defines the transformation from the coordinate system of this spatial object to the one of the given other in spatial object.

Use Maths.UlpDouble and/or Maths.Ulp to obtain maximum opt / minimum opt values for open interval checks.

Pick​Ray


public method PickRay → (4)

ray in : Ray

The ray.

point out : Vec3D

Output for picked point on the model surface.

normal out : Vec3D

The model surface normal vector at the picked point out.

maximum opt : float64 = Maths.MaxDouble

The maximum ray distance value to return (see Ray.Distance2). Smaller values for maximum opt benefit performance. Use Maths.Ulp to obtain boundary values for less-than checks.

returns → bool

true if a point has been picked,
false if the ray does not intersect with the model surface.

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

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

Extensions

Collides​With


public static method CollidesWith → (5)

other in : ISpatialQuery

[not-null]
The other spatial object.

transform in : AffineTransform

The transformation from this object (first) to the given other in one (second).

distance opt : float64 = 0

The distance value that is considered to be a collision.

tolerance opt : float64 = 0

The distance value tolerance to use for. When an implementation processes a spatial entity that produces distance values in the range x+/-tolerance which contains distance opt, it may assume that a collision occurs. Greater values for tolerance opt usually benefit performance. For maximum accuracy, use 0.

callback opt : ISpatialCallback = null

Optional spatial query callback to use.

returns → bool

true if the spatial objects collide, i.e. their distance is less than or equal to distance opt,
false if the spatial objects do not collide.

Checks if this spatial object collides with the given other in one.

The collision test is performed in the coordinate system of this spatial object. The given transform in defines the transformation from the coordinate system of this spatial object to the one of the given other in spatial object.