CheL0: The level 0 of CHE - Prograf-UFF/che.js GitHub Wiki
This class represents the level 0 of CHE, it only contains the most basic information needed for triangular meshes, which are the geometry about the vertices and which vertices represent each triangle.
Attributes
- _tableGeometry: saves the geometry data of each vertex
- _tableVertices: Stores which vertices are part of each triangle
- _nVertex: Stores the amount of vertices in the _tableGeometry attribute
- _nTriangle: Stores the amount of triangles in the _tableVertices attribute
Initializers
- computeNormals()
- Computes the normal of each vertex of the mesh.
Getters
-
vertexCount: returns the amount of vertices in the mesh.
-
triangleCount: returns the amount of triangles in the mesh.
-
halfEdgeCount: returns the amount of half-edges in the mmesh.
-
getVertex(vertexId)
- returns the vertex at the vertexId index.
-
getHalfEdgeVertex(heId)
- returns the vertex associated with the half-edge at the heId index.
-
triangle(heId)
- returns the triangle that the half-edge at heId is a part of.
-
getTriangleCenter(triId)
- returns the average x,y,z from the three vertices in the triId triangle.
Validators
- isValidVertex(vertexId)
- checks if vertexId is a valid vertex element.
- isValidHalfEdge(heId)
- checks if heId is a valid half-edge element.
Geommetry modification
- setVertex(vertexId, geometry)
- changes the geometry of the vertex at the vertexId index.
- setHalfEdgeVertex(heId, vertexId)
- changes the vertex assocciated with a half-edge.
Half-Edge operators
-
nextHalfEdge(heId)
- returns the index of the "next" half-edge in the triangle that heId is a part of.
-
previousHalfEdge(heId)
- returns the index of the "previous" half-edge in the triangle that heId is a part of.
Relation methods
-
relation00(vertexId)
- Returns the index of the vertices in the star of the vertex identified by vertexId.
-
relation02(vertexId)
- Returns the index of the triangles in the star of the vertex identified by vertexId.
-
relation10(halfEdgeId)
- Returns the index of the vertices in the star of the edge identified by halfEdgeId.
-
relation12(halfEdgeId)
- Returns the index of the triangles in the star of the edge identified by halfEdgeId.
-
relation22(halfEdgeId)
- Returns the index of the triangles in the star of the triangle that contains the half-edge identified by halfEdgeId.
Integrity
- testGeometryTable()
- checks if the amount of vertex stores in the geometry table is equal to the _nVertex attribute.
- testVertexTable()
- checks if the amount of elements in the vertice table is equal to 3 * the value of _nTriangle.
- testHalfEdges()
- Checks if all half-edges are valid, by checking if all of them have "next" and "previous" half-edges.