ISpatialDistanceTrait

Description

[StaticTemplate]
interface Tinman.Terrain.Util.ISpatialDistanceTrait
<TEntity in val>
<TCoords in val>

Type trait for omnidirectional distance queries.

Public / Methods

Compute​Distance

2 overloads


[Pure]
public method ComputeDistance1 → (3)

coords in : TCoords

Coordinates of point.

distance in : float64

The current nearest distance.

entity in : TEntity

The spatial entity.

returns → float64

The nearest distance.

Computes the nearest distance from the given point to the spatial entity.


[Pure]
public method ComputeDistance2 → (5)

coords in : TCoords

Coordinates of point.

distance in : float64

The current nearest distance.

entity in : TEntity

The spatial entity.

vertices out : Vec3I

Vertex indices that describe the location of the nearest spatial entity feature. If the spatial entity does not have any vertices, Vec3I.Zero is returned. Vertex index values with a weight of zero are ignored, but their value is retained.

weights out : Vec3D

Location of the nearest spatial entity feature, given as relative weights (i.e. the weight sum is 1) of vertices out. The weights are sorted in descending order, i.e. Vec3D.X always holds the greatest weight and Vec3D.Z always holds the smallest weight. The sum of all weights is 1. If the spatial entity does not have any vertices, Vec3D.Zero is returned.

returns → float64

The nearest distance.

Computes the nearest distance from the given point to the spatial entity.

A default implementation should forward to ComputeDistance1 and set vertices out to Vec3I.Zero and weights out to Vec3D.Zero.