![]() |
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 | SimplificationContraction { SimplificationContraction::Average, SimplificationContraction::Quadric } |
| Indicates the method that is used for mesh simplification if multiple vertices are combined to a single one. More... | |
| enum | FilterScope { FilterScope::All, FilterScope::Color, FilterScope::Normal, FilterScope::Vertex } |
| Indicates the scope of filter operations. More... | |
| enum | DeformAsRigidAsPossibleEnergy { DeformAsRigidAsPossibleEnergy::Spokes, DeformAsRigidAsPossibleEnergy::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.
|
protected |
A triangle vertices indexes container.
| 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 |
|
override |
SimpleMesh destructor.
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.
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.
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 |
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.
Referenced by AddTriangle(), define_SimpleMesh(), and cloudViewer::ManualSegmentationTools::segmentMesh().
|
inline |
Clears the mesh.
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.
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.
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.
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.
References cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, m_triIndexes, and theVertices.
|
overridevirtual |
|
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.
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.
References 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.
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.
References globalIterator.
|
virtual |
Reserves the memory to store the triangles (as 3 indexes each)
| n | the number of triangles to reserve |
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 |
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.
Referenced by AddTriangle(), ImportSourceVertices(), MergeOldTriangles(), cloudViewer::ManualSegmentationTools::segmentMesh(), and cloudViewer::ManualSegmentationTools::segmentMeshWithAABox().
|
inline |
Returns the vertices.
Referenced by ccCropTool::Crop(), and define_SimpleMesh().
|
protected |
Dump triangle structure to transmit temporary data.
Referenced by _getTriangle().
|
protected |
Iterator on the list of triangles.
Referenced by _getNextTriangle(), getNextTriangleVertIndexes(), and placeIteratorAtBeginning().
|
protected |
Bounding-box.
Referenced by addTriangle().
|
protected |
The triangles indexes.
Referenced by _getTriangle(), addTriangle(), forEach(), getTriangleVertices(), getTriangleVertIndexes(), interpolateNormals(), reserve(), and resize().
|
protected |
The associated point cloud (vertices)
Referenced by _getTriangle(), forEach(), getBoundingBox(), getTriangleVertices(), interpolateNormals(), normalsAvailable(), and ~SimpleMesh().
|
protected |
Specifies if the associated cloud should be deleted when the mesh is deleted
Referenced by ~SimpleMesh().