PointInfo

Description

class Tinman.Terrain.Meshing.PointInfo

Represents local information about a point on the terrain-surface.

See also

Picking

Public / Constructors

Point​Info


public constructor PointInfo → ()

Creates a new instance of PointInfo.

Public / Methods

Clear


public method Clear → ()

Clears all flags of this point info object and resets all values.

See also

PointInfo.Flags

Compute


public method Compute → (5)

coords in : Int3

The heightmap coordinate vertex array (see Semantic.HeightmapCoords) or null.

elevation in : Float1

The elevation vertex array (see Semantic.Elevation) or null.

position in : Double3

The vertex position vertex array (see Semantic.Position) or null.

normal in : Float3

The normal vector vertex array (see Semantic.Normal) or null.

flags opt : PointInfoFlags = PointInfoFlags.All

The point info flags of the values to compute.

Computes missing point info values based on the available input data.

Public / Attributes

Elevation


public attribute Elevation → (get,set)

value : float32

The elevation value or 0 if not present (see PointInfoFlags.Elevation).

The terrain-space elevation.

If the given value in is not a number (see Maths.IsNumber), the corresponding point info flag flag will be cleared.

Face


public attribute Face → (get)

value : CubemapFace

The cubemap face.

The cubemap face of the triangle that contains the point (derived from PointInfoFlags.Heightmap and Vertices).

Flags


public attribute Flags → (get)

value : PointInfoFlags

The point info flags.

A bitmask that indicates which values have been computed and are thus valid.

Heightmap


public attribute Heightmap → (get,set)

value : Vec3D

The heightmap coordinates or Vec3D.Zero if not present (see PointInfoFlags.Heightmap).

Heightmap coordinates of the picked point, relative to HeightmapsUtil.MaxSize.

If the given value in is undefined (see Vec3D.IsUndefined), the corresponding point info flag flag will be cleared.

Normal


public attribute Normal → (get,set)

value : Vec3F

The normal vector or Vec3F.Zero if not present (see PointInfoFlags.Normal).

Unit-length terrain-space normal vector.

Position


public attribute Position → (get,set)

value : Vec3D

The point coordinates or Vec3D.Zero if not present (see PointInfoFlags.Position).

The point position, in terrain-space.

Sector


public attribute Sector → (get,set)

value : int32

The vertex index of the mesh sector center or -1 if not present (see PointInfoFlags.Sector).

The mesh sector that contains the picked point.

Vertices


public attribute Vertices → (get,set)

value : Vec3I

The vertex indices or Vec3I.Zero if not present (see PointInfoFlags.Vertices).

Indices of vertices of picked triangle.

The vertices of the picked triangle are oriented so that the vector cross(Y-X, Z-X) points into the direction of the triangle face normal.

Weights


public attribute Weights → (get,set)

value : Vec3D

The barycentric weights or Vec3D.Zero if not present (see PointInfoFlags.Weights).

The barycentric coordinates (range [0..1]) of picked point in picked triangle.

If the given value in is undefined (see Vec3D.IsUndefined), the corresponding point info flag flag will be cleared.

The picked point can be expressed using barycentric coordinates as follows:

p = A * w1 + B * w2 + C * w3

where
p := the picked point
A := first vertex of picked triangle
B := second vertex of picked triangle
C := third vertex of picked triangle
w1 := first barycentric coordinate of picked point in picked triangle ( Vec3D.X)
w2 := second barycentric coordinate of picked point in picked triangle ( Vec3D.Y)
w3 := third barycentric coordinate of picked point in picked triangle ( Vec3D.Z)

The sum of the barycentric coordinates is always 1.0 (i.e. w1 + w2 + w3 = 1).