Class for storing a triangle mesh.
Format:
- vertices are stored in an array
- triangles are stored as an index triple into the vertex array, three consecutive entries in the indices_ array define a triangle
When adding new vertices no check is done if this vertex already exist. To remove duplicate vertices (and adapt the indices that store the triangles) use removeDuplicateVertices()
|
|
| size_t | getNumTriangles () const |
| |
| size_t | getNumVertexIndices () const |
| |
| size_t | getNumNormalIndices () const |
| |
| index_t | getNumVertices () const |
| |
| index_t | getNumNormals () const |
| |
| math::AABB | getAABB () const |
| |
|
| const vertex_t & | getVertex (index_t i) const |
| |
| const normal_t & | getVertexNormal (index_t i) const |
| |
| const color_t & | getVertexColor (index_t i) const |
| |
| void | clear () |
| |
| index_t | getVertexIndex (index_t i) const |
| |
| index_t | getVertexIndex (size_t triangle, uint8_t index) const |
| |
| index_t | getNormalIndex (index_t i) const |
| |
| index_t | getNormalIndex (size_t triangle, uint8_t index) const |
| |
| bool | hasVertexNormals () const |
| |
| bool | hasVertexColors () const |
| |
| bool | hasNormalIndices () const |
| |
| void | getTriangle (size_t triangleIdx, vertex_t &v0, vertex_t &v1, vertex_t &v2) const |
| |
| void | getTriangle (size_t triangleIdx, vertex_t &v0, vertex_t &v1, vertex_t &v2, color_t &c0, color_t &c1, color_t &c2) const |
| |
| void | getTriangleVertexNormals (size_t triangleIdx, normal_t &n0, normal_t &n1, normal_t &n2) const |
| |
| const std::vector< index_t > & | getVertexIndices () const |
| |
| const std::vector< index_t > & | getNormalIndices () const |
| |
| const std::vector< vertex_t > & | getVertices () const |
| |
| const std::vector< normal_t > & | getVertexNormals () const |
| |
| const std::vector< color_t > & | getVertexColors () const |
| |
| std::vector< index_t > & | getVertexIndices () |
| |
| std::vector< index_t > & | getNormalIndices () |
| |
| std::vector< vertex_t > & | getVertices () |
| |
| std::vector< normal_t > & | getVertexNormals () |
| |
| std::vector< color_t > & | getVertexColors () |
| |
| template<typename OutputIterator > |
| void | getVerticesOfColor (const color_t &color, OutputIterator outIt) const |
| |
| real_t | volume () const |
| |
| real_t | surfaceArea () const |
| |
|
| index_t | addVertex (const vertex_t &v) |
| | Adds a vertex to the mesh and returns its index No duplicate check is done when inserting, instead use removeDuplicateVertices.
|
| |
| index_t | addVertex (const vertex_t &v, const color_t &c) |
| |
| index_t | addVertexNormal (const normal_t &n) |
| |
| void | addTriangle (index_t v0Idx, index_t v1Idx, index_t v2Idx) |
| | Adds a triangle to the mesh, as parameters use the return values of addVertex()
|
| |
| void | addTriangle (index_t v0Idx, index_t v1Idx, index_t v2Idx, index_t n0Idx, index_t n1Idx, index_t n2Idx) |
| |
| size_t walberla::geometry::TriangleMesh::removeDuplicateVertices |
( |
real_t | tolerance = real_t(1e-4) | ) |
|
Removes duplicate vertices i.e.
vertices with same positions
This is expensive, since the vertex array has to be sorted, scanned for duplicates, and the face indices array has to be rewritten.
- Warning
- This function changes vertex indices! Consider this when adding triangles.
- Parameters
-
| tolerance | two vertices are considered equal if each of their coordinates does not differ more than the tolerance value (maximum-norm) |
- Returns
- The number of removed vertices