![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
A simple mesh structure, with index-based vertex access. More...
#include <SimpleMesh.h>


Public Member Functions | |
| SimpleMesh (GenericIndexedCloud *_theVertices, bool linkVerticesWithMesh=false) | |
| SimpleMesh Constructor. More... | |
| ~SimpleMesh () override | |
| SimpleMesh destructor. More... | |
| void | forEach (genericTriangleAction action) override |
| Fast iteration mechanism. More... | |
| void | placeIteratorAtBeginning () override |
| Places the mesh iterator at the beginning. More... | |
| GenericTriangle * | _getNextTriangle () override |
| Returns the next triangle (relatively to the global iterator position) More... | |
| GenericTriangle * | _getTriangle (unsigned triangleIndex) override |
| Returns the ith triangle. More... | |
| VerticesIndexes * | getNextTriangleVertIndexes () override |
| VerticesIndexes * | getTriangleVertIndexes (unsigned triangleIndex) override |
| Returns the indexes of the vertices of a given triangle. More... | |
| virtual unsigned | size () const override |
| Returns the number of triangles. More... | |
| void | getBoundingBox (CCVector3 &bbMin, CCVector3 &bbMax) override |
| Returns the mesh bounding-box. More... | |
| void | getTriangleVertices (unsigned triangleIndex, CCVector3 &A, CCVector3 &B, CCVector3 &C) const override |
| Returns the vertices of a given triangle. More... | |
| virtual void | getTriangleVertices (unsigned triangleIndex, double A[3], double B[3], double C[3]) const override |
| unsigned | capacity () const |
| Returns the mesh capacity. More... | |
| const GenericIndexedCloud * | vertices () const |
| Returns the vertices. More... | |
| void | clear () |
| Clears the mesh. More... | |
| virtual void | addTriangle (unsigned i1, unsigned i2, unsigned i3) |
| Adds a triangle to the mesh. More... | |
| virtual bool | reserve (unsigned n) |
| Reserves the memory to store the triangles (as 3 indexes each) More... | |
| virtual bool | resize (unsigned n) |
| Resizes the mesh database. More... | |
| bool | normalsAvailable () const override |
| Returns whether normals are available. More... | |
| bool | interpolateNormals (unsigned triIndex, const CCVector3 &P, CCVector3 &N) override |
| Interpolates normal(s) inside a given triangle. More... | |
Public Member Functions inherited from cloudViewer::GenericIndexedMesh | |
| GenericIndexedMesh ()=default | |
| ~GenericIndexedMesh () override=default | |
| Default destructor. More... | |
Public Member Functions inherited from cloudViewer::GenericMesh | |
| GenericMesh ()=default | |
| virtual | ~GenericMesh ()=default |
| Default destructor. More... | |
| virtual bool | hasTriangles () const |
Protected Types | |
| using | TriangleIndexesContainer = std::vector< VerticesIndexes > |
| A triangle vertices indexes container. More... | |
Protected Attributes | |
| TriangleIndexesContainer | m_triIndexes |
| The triangles indexes. More... | |
| unsigned | globalIterator |
| Iterator on the list of triangles. More... | |
| SimpleTriangle | dummyTriangle |
| Dump triangle structure to transmit temporary data. More... | |
| GenericIndexedCloud * | theVertices |
| The associated point cloud (vertices) More... | |
| bool | verticesLinked |
| BoundingBox | m_bbox |
| Bounding-box. More... | |
Additional Inherited Members | |
Public Types inherited from cloudViewer::GenericMesh | |
| enum class | SimplificationContraction { Average , Quadric } |
| Indicates the method that is used for mesh simplification if multiple vertices are combined to a single one. More... | |
| enum class | FilterScope { All , Color , Normal , Vertex } |
| Indicates the scope of filter operations. More... | |
| enum class | DeformAsRigidAsPossibleEnergy { Spokes , Smoothed } |
| using | genericTriangleAction = std::function< void(GenericTriangle &)> |
| Generic function to apply to a triangle (used by foreach) More... | |
A simple mesh structure, with index-based vertex access.
Implements the GenericIndexedMesh interface. This mesh is always associated to a (index based) point cloud that stores the mesh vertexes.
Definition at line 26 of file SimpleMesh.h.
|
protected |
A triangle vertices indexes container.
Definition at line 102 of file SimpleMesh.h.
| SimpleMesh::SimpleMesh | ( | GenericIndexedCloud * | _theVertices, |
| bool | linkVerticesWithMesh = false |
||
| ) |
SimpleMesh Constructor.
| _theVertices | the point cloud containing the vertices |
| linkVerticesWithMesh | specifies if the vertex cloud should be deleted when the SimpleMesh object is destructed |
Definition at line 18 of file SimpleMesh.cpp.
|
override |
SimpleMesh destructor.
Definition at line 25 of file SimpleMesh.cpp.
References theVertices, and verticesLinked.
|
overridevirtual |
Returns the next triangle (relatively to the global iterator position)
Virtual method to handle the mesh global iterator. Global iterator position should be increased each time this method is called. The returned object can be temporary.
Implements cloudViewer::GenericMesh.
Definition at line 45 of file SimpleMesh.cpp.
References _getTriangle(), and globalIterator.
|
overridevirtual |
Returns the ith triangle.
Virtual method to request a triangle with a specific index. The returned object can be temporary.
| triangleIndex | of the requested triangle (between 0 and the mesh size-1) |
Implements cloudViewer::GenericIndexedMesh.
Definition at line 49 of file SimpleMesh.cpp.
References cloudViewer::SimpleTriangle::A, cloudViewer::SimpleTriangle::B, cloudViewer::SimpleTriangle::C, dummyTriangle, cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, m_triIndexes, and theVertices.
Referenced by _getNextTriangle().
|
virtual |
Adds a triangle to the mesh.
Vertex indexes are expresesed relatively to the vertex cloud.
| i1 | first vertex index |
| i2 | second vertex index |
| i3 | third vertex index |
Definition at line 103 of file SimpleMesh.cpp.
References m_bbox, m_triIndexes, and cloudViewer::BoundingBoxTpl< T >::setValidity().
Referenced by AddTriangle(), define_SimpleMesh(), MergeOldTriangles(), cloudViewer::ManualSegmentationTools::segmentMesh(), and cloudViewer::Neighbourhood::triangulateFromQuadric().
|
inline |
Returns the mesh capacity.
Definition at line 62 of file SimpleMesh.h.
Referenced by AddTriangle(), define_SimpleMesh(), and cloudViewer::ManualSegmentationTools::segmentMesh().
|
inline |
Clears the mesh.
Definition at line 70 of file SimpleMesh.h.
Referenced by define_SimpleMesh(), and cloudViewer::ManualSegmentationTools::segmentMeshWithAABox().
|
overridevirtual |
Fast iteration mechanism.
Virtual method to apply a function to the whole mesh
| action | function to apply (see GenericMesh::genericTriangleAction) |
Implements cloudViewer::GenericMesh.
Definition at line 32 of file SimpleMesh.cpp.
References cloudViewer::SimpleTriangle::A, cloudViewer::SimpleTriangle::B, cloudViewer::SimpleTriangle::C, count, cloudViewer::GenericIndexedCloud::getPoint(), m_triIndexes, and theVertices.
Returns the mesh bounding-box.
Virtual method to request the mesh bounding-box limits. It is equivalent to the bounding-box of the cloud composed of the mesh vertexes.
| bbMin | lower bounding-box limits (Xmin,Ymin,Zmin) |
| bbMax | higher bounding-box limits (Xmax,Ymax,Zmax) |
Implements cloudViewer::GenericMesh.
Definition at line 84 of file SimpleMesh.cpp.
References cloudViewer::GenericCloud::getBoundingBox(), and theVertices.
|
overridevirtual |
Returns the indexes of the vertices of the next triangle (relatively to the global iterator position)
Implements cloudViewer::GenericIndexedMesh.
Definition at line 184 of file SimpleMesh.cpp.
References getTriangleVertIndexes(), and globalIterator.
|
overridevirtual |
Returns the vertices of a given triangle.
| [in] | triangleIndex | index of the triangle (between 0 and the size(mesh)-1) |
| [out] | A | first vertex |
| [out] | B | second vertex |
| [out] | C | third vertex |
Implements cloudViewer::GenericIndexedMesh.
Definition at line 60 of file SimpleMesh.cpp.
References cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, m_triIndexes, and theVertices.
|
overridevirtual |
Implements cloudViewer::GenericIndexedMesh.
Definition at line 72 of file SimpleMesh.cpp.
References cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, m_triIndexes, and theVertices.
|
overridevirtual |
Returns the indexes of the vertices of a given triangle.
| triangleIndex | index of the triangle (between 0 and size(mesh)-1) |
Implements cloudViewer::GenericIndexedMesh.
Definition at line 180 of file SimpleMesh.cpp.
References m_triIndexes.
Referenced by getNextTriangleVertIndexes(), ImportSourceVertices(), and MergeOldTriangles().
|
overridevirtual |
Interpolates normal(s) inside a given triangle.
This method should be ideally overriden by the child class if normals are supported
| [in] | triIndex | triangle index |
| [in] | P | point where to interpolate (should be inside the triangle!) |
| [out] | N | interpolated normal |
Reimplemented from cloudViewer::GenericIndexedMesh.
Definition at line 131 of file SimpleMesh.cpp.
References cross(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, m_triIndexes, theVertices, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.
|
overridevirtual |
Returns whether normals are available.
Reimplemented from cloudViewer::GenericIndexedMesh.
Definition at line 127 of file SimpleMesh.cpp.
References cloudViewer::GenericIndexedCloud::normalsAvailable(), and theVertices.
|
overridevirtual |
Places the mesh iterator at the beginning.
Virtual method to handle the mesh global iterator
Implements cloudViewer::GenericMesh.
Definition at line 43 of file SimpleMesh.cpp.
References globalIterator.
|
virtual |
Reserves the memory to store the triangles (as 3 indexes each)
| n | the number of triangles to reserve |
Definition at line 109 of file SimpleMesh.cpp.
References m_triIndexes.
Referenced by AddTriangle(), define_SimpleMesh(), MergeOldTriangles(), cloudViewer::ManualSegmentationTools::segmentMesh(), and cloudViewer::Neighbourhood::triangulateFromQuadric().
|
virtual |
Resizes the mesh database.
If the new number of elements is smaller than the actual size, the overflooding elements will be deleted.
| n | the new number of triangles |
Definition at line 118 of file SimpleMesh.cpp.
References m_triIndexes.
Referenced by define_SimpleMesh(), MergeOldTriangles(), cloudViewer::ManualSegmentationTools::segmentMesh(), and cloudViewer::ManualSegmentationTools::segmentMeshWithAABox().
|
inlineoverridevirtual |
Returns the number of triangles.
Virtual method to request the mesh size
Implements cloudViewer::GenericMesh.
Definition at line 47 of file SimpleMesh.h.
Referenced by AddTriangle(), ImportSourceVertices(), MergeOldTriangles(), cloudViewer::ManualSegmentationTools::segmentMesh(), and cloudViewer::ManualSegmentationTools::segmentMeshWithAABox().
|
inline |
Returns the vertices.
Definition at line 67 of file SimpleMesh.h.
Referenced by ccCropTool::Crop(), and define_SimpleMesh().
|
protected |
Dump triangle structure to transmit temporary data.
Definition at line 109 of file SimpleMesh.h.
Referenced by _getTriangle().
|
protected |
Iterator on the list of triangles.
Definition at line 107 of file SimpleMesh.h.
Referenced by _getNextTriangle(), getNextTriangleVertIndexes(), and placeIteratorAtBeginning().
|
protected |
|
protected |
The triangles indexes.
Definition at line 104 of file SimpleMesh.h.
Referenced by _getTriangle(), addTriangle(), forEach(), getTriangleVertices(), getTriangleVertIndexes(), interpolateNormals(), reserve(), and resize().
|
protected |
The associated point cloud (vertices)
Definition at line 112 of file SimpleMesh.h.
Referenced by _getTriangle(), forEach(), getBoundingBox(), getTriangleVertices(), interpolateNormals(), normalsAvailable(), and ~SimpleMesh().
|
protected |
Specifies if the associated cloud should be deleted when the mesh is deleted
Definition at line 115 of file SimpleMesh.h.
Referenced by ~SimpleMesh().