MeshLib JavaScript Docs
Loading...
Searching...
No Matches

Public Member Functions

void pack ()
 tightly packs all arrays eliminating lone edges and invalid faces, vertices and points
void packOptimally ()
number volume ()
number area ()
 returns the area of given face
Box3f computeBoundingBox ()
void invalidateCaches ()
void transform (AffineXf3f xf)
number averageEdgeLength ()
 computes average length of an edge in this mesh
void addMesh (Mesh from)
 appends another mesh as separate connected component(s) to this
number edgeLength (number e)
 returns Euclidean length of the edge
number edgeLengthSq (number e)
 returns squared Euclidean length of the edge (faster to compute than length)
Vector3f normal (number v)
 computes triangular face normal from its vertices
Vector3f findCenterFromPoints ()
 computes average position of all valid mesh vertices
Vector3f findCenterFromFaces ()
 computes center of mass considering that density of all triangles is the same
Vector3f findCenterFromBBox ()
 computes bounding box and returns its center
MeshTriPoint toTriPoint (number f, Vector3f p)
 converts vertex into barycentric representation

Static Public Member Functions

static Mesh fromTriangles (VertCoords vertexCoordinates, Triangulation t)
 construct mesh from vertex coordinates and a set of triangles with given ids
static Mesh fromTrianglesDuplicatingNonManifoldVertices (VertCoords vertexCoordinates, Triangulation t)

Public Attributes

MeshTopology topology
VertCoords points

Detailed Description

This class represents a mesh, including topology (connectivity) information and point coordinates, as well as some caches to accelerate search algorithms

Member Function Documentation

◆ addMesh()

void Mesh::addMesh ( Mesh from)

appends another mesh as separate connected component(s) to this

◆ area()

number Mesh::area ( )

returns the area of given face

◆ averageEdgeLength()

number Mesh::averageEdgeLength ( )

computes average length of an edge in this mesh

◆ computeBoundingBox()

Box3f Mesh::computeBoundingBox ( )

passes through all valid vertices and finds the minimal bounding box containing all of them; if toWorld transformation is given then returns minimal bounding box in world space

◆ edgeLength()

number Mesh::edgeLength ( number e)

returns Euclidean length of the edge

◆ edgeLengthSq()

number Mesh::edgeLengthSq ( number e)

returns squared Euclidean length of the edge (faster to compute than length)

◆ findCenterFromBBox()

Vector3f Mesh::findCenterFromBBox ( )

computes bounding box and returns its center

◆ findCenterFromFaces()

Vector3f Mesh::findCenterFromFaces ( )

computes center of mass considering that density of all triangles is the same

◆ findCenterFromPoints()

Vector3f Mesh::findCenterFromPoints ( )

computes average position of all valid mesh vertices

◆ fromTriangles()

Mesh Mesh::fromTriangles ( VertCoords vertexCoordinates,
Triangulation t )
static

construct mesh from vertex coordinates and a set of triangles with given ids

◆ fromTrianglesDuplicatingNonManifoldVertices()

Mesh Mesh::fromTrianglesDuplicatingNonManifoldVertices ( VertCoords vertexCoordinates,
Triangulation t )
static

construct mesh from vertex coordinates and a set of triangles with given ids; unlike simple fromTriangles() it tries to resolve non-manifold vertices by creating duplicate vertices

◆ invalidateCaches()

void Mesh::invalidateCaches ( )

invalidates caches (aabb-trees) after any change in mesh geometry or topology

Parameters
pointsChangedspecifies whether points have changed (otherwise only topology has changed)

◆ normal()

Vector3f Mesh::normal ( number v)

computes triangular face normal from its vertices

◆ pack()

void Mesh::pack ( )

tightly packs all arrays eliminating lone edges and invalid faces, vertices and points

◆ packOptimally()

void Mesh::packOptimally ( )

packs tightly and rearranges vertices, triangles and edges to put close in space elements in close indices

Parameters
preserveAABBTreewhether to keep valid mesh's AABB tree after return (it will take longer to compute and it will occupy more memory)

◆ toTriPoint()

MeshTriPoint Mesh::toTriPoint ( number f,
Vector3f p )

converts vertex into barycentric representation

◆ transform()

void Mesh::transform ( AffineXf3f xf)

applies given transformation to specified vertices if region is nullptr, all valid mesh vertices are used

◆ volume()

number Mesh::volume ( )

returns volume of the object surrounded by given region (or whole mesh if (region) is nullptr); if the region has holes then each hole will be virtually filled by adding triangles for each edge and the hole's geometrical center

Member Data Documentation

◆ points

VertCoords Mesh::points

◆ topology

MeshTopology Mesh::topology

The documentation for this class was generated from the following file: