CCCoreLib 31 May 2022
CloudCompare Core algorithms
|
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. | |
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 |
Returns the indexes of the vertices of the next triangle (relatively to the global iterator position) More... | |
VerticesIndexes * | getTriangleVertIndexes (unsigned triangleIndex) override |
Returns the indexes of the vertices of a given triangle. More... | |
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... | |
unsigned | capacity () const |
Returns the mesh capacity. | |
const GenericIndexedCloud * | vertices () const |
Returns the vertices. | |
void | clear () |
Clears the mesh. | |
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 CCCoreLib::GenericIndexedMesh | |
~GenericIndexedMesh () override=default | |
Default destructor. | |
virtual GenericTriangle * | _getTriangle (unsigned triangleIndex)=0 |
Returns the ith triangle. More... | |
virtual VerticesIndexes * | getTriangleVertIndexes (unsigned triangleIndex)=0 |
Returns the indexes of the vertices of a given triangle. More... | |
virtual void | getTriangleVertices (unsigned triangleIndex, CCVector3 &A, CCVector3 &B, CCVector3 &C) const =0 |
Returns the vertices of a given triangle. More... | |
virtual VerticesIndexes * | getNextTriangleVertIndexes ()=0 |
Returns the indexes of the vertices of the next triangle (relatively to the global iterator position) More... | |
virtual bool | normalsAvailable () const |
Returns whether normals are available. More... | |
virtual bool | interpolateNormals (unsigned triIndex, const CCVector3 &P, CCVector3 &N) |
Interpolates normal(s) inside a given triangle. More... | |
Public Member Functions inherited from CCCoreLib::GenericMesh | |
virtual | ~GenericMesh ()=default |
Default destructor. | |
virtual unsigned | size () const =0 |
Returns the number of triangles. More... | |
virtual void | forEach (genericTriangleAction action)=0 |
Fast iteration mechanism. More... | |
virtual void | getBoundingBox (CCVector3 &bbMin, CCVector3 &bbMax)=0 |
Returns the mesh bounding-box. More... | |
virtual void | placeIteratorAtBeginning ()=0 |
Places the mesh iterator at the beginning. More... | |
virtual GenericTriangle * | _getNextTriangle ()=0 |
Returns the next triangle (relatively to the global iterator position) More... | |
Protected Types | |
using | TriangleIndexesContainer = std::vector< VerticesIndexes > |
A triangle vertices indexes container. | |
Protected Attributes | |
TriangleIndexesContainer | triIndexes |
The triangles indexes. | |
unsigned | globalIterator |
Iterator on the list of triangles. | |
SimpleTriangle | dummyTriangle |
Dump triangle structure to transmit temporary data. | |
GenericIndexedCloud * | theVertices |
The associated point cloud (vertices) | |
bool | verticesLinked |
Specifies if the associated cloud should be deleted when the mesh is deleted. | |
BoundingBox | m_bbox |
Bounding-box. | |
Additional Inherited Members | |
Public Types inherited from CCCoreLib::GenericMesh | |
using | genericTriangleAction = std::function< void(GenericTriangle &)> |
Generic function to apply to a triangle (used by foreach) | |
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.
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 |
|
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 CCCoreLib::GenericMesh.
|
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 CCCoreLib::GenericIndexedMesh.
|
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 |
|
overridevirtual |
Fast iteration mechanism.
Virtual method to apply a function to the whole mesh
action | function to apply (see GenericMesh::genericTriangleAction) |
Implements CCCoreLib::GenericMesh.
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 CCCoreLib::GenericMesh.
|
overridevirtual |
Returns the indexes of the vertices of the next triangle (relatively to the global iterator position)
Implements CCCoreLib::GenericIndexedMesh.
|
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 CCCoreLib::GenericIndexedMesh.
|
overridevirtual |
Returns the indexes of the vertices of a given triangle.
triangleIndex | index of the triangle (between 0 and size(mesh)-1) |
Implements CCCoreLib::GenericIndexedMesh.
|
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 CCCoreLib::GenericIndexedMesh.
|
overridevirtual |
Returns whether normals are available.
Reimplemented from CCCoreLib::GenericIndexedMesh.
|
overridevirtual |
Places the mesh iterator at the beginning.
Virtual method to handle the mesh global iterator
Implements CCCoreLib::GenericMesh.
|
virtual |
Reserves the memory to store the triangles (as 3 indexes each)
n | the number of triangles to reserve |
|
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 |
|
inlineoverridevirtual |
Returns the number of triangles.
Virtual method to request the mesh size
Implements CCCoreLib::GenericMesh.