Mesh
verb.core.Mesh
CLASS
Mesh
provides various convenience methods for working with meshes.
getTriangleNorm
STATIC METHOD
getTriangleNorm(points : Array<Point>, tri : Tri) : Point
Get triangle normal
params
- array of length 3 arrays of numbers representing the points
- length 3 array of point indices for the triangle
returns
- a normal vector represented by an array of length 3
makeMeshAabb
STATIC METHOD
makeMeshAabb(mesh : MeshData, faceIndices : Array<Int>) : BoundingBox
Form axis-aligned bounding box from triangles of mesh
params
- a mesh
- face indices of the mesh to include in the bounding box
returns
- a BoundingBox containing the mesh
sortTrianglesOnLongestAxis
STATIC METHOD
sortTrianglesOnLongestAxis(bb : BoundingBox, mesh : MeshData, faceIndices : Array<Int>) : Array<Int>
Sort particular faces of a mesh on the longest axis
params
- bounding box containing the faces
- the mesh it self
- the indices of the mesh faces to inspect
returns
- a point represented by an array of length (dim)
getTriangleCentroid
STATIC METHOD
getTriangleCentroid(points : Array<Point>, tri : Tri) : Point
Get triangle centroid
params
- array of length 3 arrays of numbers representing the points
- length 3 array of point indices for the triangle
returns
- a point represented by an array of length 3
triangleUVFromPoint
STATIC METHOD
triangleUVFromPoint(mesh : MeshData, faceIndex : Int, f : Point) : UV
Given a point on a mesh triangle, obtain the UV on the triangle
params
- the mesh
- index of the face to test
returns
- the UV on the face