ModelsUtil

Description

static class Tinman.Engine.Models.ModelsUtil

Helper class for dealing with 3D model hierarchies.

The Distance* methods can be used for low-level distance computations for common geometric primitives found in 3D model hierarchies:

  • Point (A)

  • Line-segment (A,B)

  • Triangle (A,B,C)

The following computation pairs are supported:

  • Point to line-segment

  • Point to triangle

  • Line-segment to line-segment

  • Line-segment to triangle

  • Triangle to triangle

These methods are similar to the ones of Geometric, except that they use different input vector parametrization in order to reduce the amount of redundant computations.

Public / Methods

Apply​Transform

2 overloads


public static method ApplyTransform1 → (4)

data in : VertexArrays

[not-null]
The vertex arrays.

scaling in : Vec3D

The scaling to apply.

offset opt : int32 = 0

[0..data.Capacity]
Index of first vertex to transform.

count opt : int32 = -1

[-1..data.Capacity-offset]
Number of vertices to transform. If -1, all vertices from offset opt until the end of the vertex arrays will be transformed.

Applies the non-uniform scaling to the given vertex arrays.


public static method ApplyTransform2 → (4)

data in : VertexArrays

[not-null]
The vertex arrays.

transform in : Mat4D

The transformation to apply.

offset opt : int32 = 0

[0..data.Capacity]
Index of first vertex to transform.

count opt : int32 = -1

[-1..data.Capacity-offset]
Number of vertices to transform. If -1, all vertices from offset opt until the end of the vertex arrays will be transformed.

Applies the given transformation to the given vertex arrays.

Distance​Line​Segment​To​Line​Segment


[Pure]
public static method DistanceLineSegmentToLineSegment → (9)

bx0 in : float64

X-coordinate of vertex B minus vertex A of first line-segment.

by0 in : float64

Y-coordinate of vertex B minus vertex A of first line-segment.

bz0 in : float64

Z-coordinate of vertex B minus vertex A of first line-segment.

ax1 in : float64

X-coordinate of vertex A of second line-segment minus vertex A of first line-segment.

ay1 in : float64

Y-coordinate of vertex A of second line-segment minus vertex A of first line-segment.

az1 in : float64

Z-coordinate of vertex A of second line-segment minus vertex A of first line-segment.

bx1 in : float64

X-coordinate of vertex B minus vertex A of second line-segment.

by1 in : float64

Y-coordinate of vertex B minus vertex A of second line-segment.

bz1 in : float64

Z-coordinate of vertex B minus vertex A of second line-segment.

returns → float64

The distance value.

Computes the distance between the given line-segment (first) and line-segment (second).

This method is similar to Geometric.DistanceLineToLine, if the returned line coefficients are clamped to [0..1].

Distance​Line​Segment​To​Triangle


[Pure]
public static method DistanceLineSegmentToTriangle → (13)

bx0 in : float64

X-coordinate of vertex B minus vertex A of first line-segment.

by0 in : float64

Y-coordinate of vertex B minus vertex A of first line-segment.

bz0 in : float64

Z-coordinate of vertex B minus vertex A of first line-segment.

ax1 in : float64

X-coordinate of vertex A of second triangle minus vertex A of first line-segment.

ay1 in : float64

Y-coordinate of vertex A of second triangle minus vertex A of first line-segment.

az1 in : float64

Z-coordinate of vertex A of second triangle minus vertex A of first line-segment.

bx1 in : float64

X-coordinate of vertex B minus vertex A of second triangle.

by1 in : float64

Y-coordinate of vertex B minus vertex A of second triangle.

bz1 in : float64

Z-coordinate of vertex B minus vertex A of second triangle.

cx1 in : float64

X-coordinate of vertex C minus vertex A of second triangle.

cy1 in : float64

Y-coordinate of vertex C minus vertex A of second triangle.

cz1 in : float64

Z-coordinate of vertex C minus vertex A of second triangle.

minimum opt : float64 = 0

The minimum distance value to return.

returns → float64

The distance value.

Computes the distance between the given line-segment (first) and triangle (second).

Distance​Point​To​Line​Segment


[Pure]
public static method DistancePointToLineSegment → (6)

ax in : float64

X-coordinate of vertex A of second line-segment minus first point.

ay in : float64

Y-coordinate of vertex A of second line-segment minus first point.

az in : float64

Z-coordinate of vertex A of second line-segment minus first point.

bx in : float64

X-coordinate of vertex B minus vertex A of second line-segment.

by in : float64

Y-coordinate of vertex B minus vertex A of second line-segment.

bz in : float64

Z-coordinate of vertex B minus vertex A of second line-segment.

returns → float64

The distance value.

Computes the distance between the given point (first) and line-segment (second).

This method is similar to Geometric.DistancePointToLineSegment3

Distance​Point​To​Triangle


[Pure]
public static method DistancePointToTriangle → (9)

ax1 in : float64

X-coordinate of vertex A of second triangle minus first point.

ay1 in : float64

Y-coordinate of vertex A of second triangle minus first point.

az1 in : float64

Z-coordinate of vertex A of second triangle minus first point.

bx1 in : float64

X-coordinate of vertex B minus vertex A of second triangle.

by1 in : float64

Y-coordinate of vertex B minus vertex A of second triangle.

bz1 in : float64

Z-coordinate of vertex B minus vertex A of second triangle.

cx1 in : float64

X-coordinate of vertex C minus vertex A of second triangle.

cy1 in : float64

Y-coordinate of vertex C minus vertex A of second triangle.

cz1 in : float64

Z-coordinate of vertex C minus vertex A of second triangle.

returns → float64

The distance value.

Computes the distance between the given point (first) and triangle (second).

This method is similar to Geometric.DistancePointToTriangle.

Distance​Triangle​To​Triangle


[Pure]
public static method DistanceTriangleToTriangle → (17)

bx0 in : float64

X-coordinate of vertex B minus vertex A of first triangle.

by0 in : float64

Y-coordinate of vertex B minus vertex A of first triangle.

bz0 in : float64

Z-coordinate of vertex B minus vertex A of first triangle.

cx0 in : float64

X-coordinate of vertex C minus vertex A of first triangle.

cy0 in : float64

Y-coordinate of vertex C minus vertex A of first triangle.

cz0 in : float64

Z-coordinate of vertex C minus vertex A of first triangle.

ax1 in : float64

X-coordinate of vertex A of second triangle minus vertex A of first triangle.

ay1 in : float64

Y-coordinate of vertex A of second triangle minus vertex A of first triangle.

az1 in : float64

Z-coordinate of vertex A of second triangle minus vertex A of first triangle.

bx1 in : float64

X-coordinate of vertex B minus vertex A of second triangle.

by1 in : float64

Y-coordinate of vertex B minus vertex A of second triangle.

bz1 in : float64

Z-coordinate of vertex B minus vertex A of second triangle.

cx1 in : float64

X-coordinate of vertex C minus vertex A of second triangle.

cy1 in : float64

Y-coordinate of vertex C minus vertex A of second triangle.

cz1 in : float64

Z-coordinate of vertex C minus vertex A of second triangle.

maximum opt : float64 = Maths.MaxDouble

The maximum distance value to return.

minimum opt : float64 = 0

The minimum distance value to return.

returns → float64

The distance value.

Computes the distance between the given triangle (first) and triangle (second).

Model​Vertex​Format​For


[Pure]
public static method ModelVertexFormatFor → (2)

vertices in : VertexArrays

[not-null]
The vertex array.

checkPositionExtra in : bool

Analyse coordinates of Semantic.Position in order to determine if ModelVertexFormat.PositionExtra must be present in the model vertex format?

returns → ModelVertexFormat

The model vertex format.

Returns the ModelVertexFormat that corresponds to the given vertex arrays.

Vertex​Arrays​For


[Pure]
public static method VertexArraysFor → (2)

modelFormat in : ModelVertexFormat

The model vertex format flags.

capacity in : int32

[>0]
The capacity, in vertices.

returns → VertexArrays

The VertexArrays object.

Returns a VertexArrays object that corresponds to the given model format.

Vertex​Format​For


[Pure]
public static method VertexFormatFor → (1)

modelFormat in : ModelVertexFormat

The model vertex format flags.

returns → IVertexFormat

The IVertexFormat object.

Returns a IVertexFormat object that corresponds to the given model format.