![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
A class to compute and handle a Delaunay 2D mesh on a subset of points. More...
#include <Delaunay2dMesh.h>


Public Member Functions | |
| Delaunay2dMesh () | |
| Delaunay2dMesh constructor. More... | |
| ~Delaunay2dMesh () override | |
| Delaunay2dMesh destructor. More... | |
| virtual void | linkMeshWith (GenericIndexedCloud *aCloud, bool passOwnership=false) |
| Associate this mesh to a point cloud. More... | |
| virtual bool | buildMesh (const std::vector< CCVector2 > &points2D, std::size_t pointCountToUse, std::string &outputErrorStr) |
| Build the Delaunay mesh on top a set of 2D points. More... | |
| virtual bool | buildMesh (const std::vector< CCVector2 > &points2D, const std::vector< int > &segments2D, std::string &outputErrorStr) |
| Build the Delaunay mesh from a set of 2D polylines. More... | |
| virtual bool | removeOuterTriangles (const std::vector< CCVector2 > &vertices2D, const std::vector< CCVector2 > &polygon2D, bool removeOutside=true) |
| Removes the triangles falling outside of a given (2D) polygon. More... | |
| virtual unsigned | size () const override |
| Returns the number of triangles. More... | |
| void | forEach (genericTriangleAction action) override |
| Fast iteration mechanism. More... | |
| void | getBoundingBox (CCVector3 &bbMin, CCVector3 &bbMax) override |
| Returns the mesh bounding-box. 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 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 |
| int * | getTriangleVertIndexesArray () |
| Returns triangles indexes array (pointer to) More... | |
| bool | removeTrianglesWithEdgesLongerThan (PointCoordinateType maxEdgeLength) |
| Filters out the triangles based on their edge length. More... | |
| GenericIndexedCloud * | getAssociatedCloud () |
| Returns associated cloud. More... | |
Public Member Functions inherited from cloudViewer::GenericIndexedMesh | |
| GenericIndexedMesh ()=default | |
| ~GenericIndexedMesh () override=default | |
| Default destructor. 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 cloudViewer::GenericMesh | |
| GenericMesh ()=default | |
| virtual | ~GenericMesh ()=default |
| Default destructor. More... | |
| virtual bool | hasTriangles () const |
Static Public Member Functions | |
| static bool | Available () |
| Returns whether 2D Delaunay triangulation is supported or not. More... | |
| static Delaunay2dMesh * | TesselateContour (const std::vector< CCVector2 > &contourPoints) |
| static Delaunay2dMesh * | TesselateContour (GenericIndexedCloudPersist *contourPoints, int flatDimension=-1) |
| Tesselates a 2D polyline (not necessarily axis-aligned) More... | |
Static Public Attributes | |
| static constexpr int | USE_ALL_POINTS = 0 |
Protected Attributes | |
| GenericIndexedCloud * | m_associatedCloud |
| Associated point cloud. More... | |
| int * | m_triIndexes |
| Triangle vertex indexes. More... | |
| int * | m_globalIterator |
| Iterator on the list of triangle vertex indexes. More... | |
| int * | m_globalIteratorEnd |
| End position of global iterator. More... | |
| unsigned | m_numberOfTriangles |
| The number of triangles. More... | |
| bool | m_cloudIsOwnedByMesh |
| SimpleTriangle | m_dumpTriangle |
| Dump triangle structure to transmit temporary data. More... | |
| VerticesIndexes | m_dumpTriangleIndexes |
| Dump triangle index structure to transmit temporary data. 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 class to compute and handle a Delaunay 2D mesh on a subset of points.
Definition at line 24 of file Delaunay2dMesh.h.
| Delaunay2dMesh::Delaunay2dMesh | ( | ) |
Delaunay2dMesh constructor.
Definition at line 30 of file Delaunay2dMesh.cpp.
Referenced by TesselateContour().
|
override |
Delaunay2dMesh destructor.
Definition at line 38 of file Delaunay2dMesh.cpp.
References linkMeshWith(), and m_triIndexes.
|
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 324 of file Delaunay2dMesh.cpp.
References cloudViewer::SimpleTriangle::A, cloudViewer::SimpleTriangle::B, cloudViewer::SimpleTriangle::C, cloudViewer::GenericIndexedCloud::getPoint(), m_associatedCloud, m_dumpTriangle, m_globalIterator, and m_globalIteratorEnd.
|
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 347 of file Delaunay2dMesh.cpp.
References cloudViewer::SimpleTriangle::A, cloudViewer::SimpleTriangle::B, cloudViewer::SimpleTriangle::C, cloudViewer::GenericIndexedCloud::getPoint(), m_associatedCloud, m_dumpTriangle, m_numberOfTriangles, and m_triIndexes.
|
static |
Returns whether 2D Delaunay triangulation is supported or not.
2D Delaunay triangulation requires the CGAL library.
Definition at line 44 of file Delaunay2dMesh.cpp.
Referenced by define_Delaunay2dMesh().
|
virtual |
Build the Delaunay mesh from a set of 2D polylines.
| points2D | a set of 2D points |
| segments2D | constraining segments (as 2 indexes per segment) |
| outputErrorStr | error string as output by the CGAL lib. (if any) |
Definition at line 63 of file Delaunay2dMesh.cpp.
References face, m_globalIterator, m_globalIteratorEnd, m_numberOfTriangles, m_triIndexes, Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.
|
virtual |
Build the Delaunay mesh on top a set of 2D points.
| points2D | a set of 2D points |
| pointCountToUse | number of points to use from the input set (USE_ALL_POINTS = all) |
| outputErrorStr | error string as output by the CGAL lib. (if any) |
Definition at line 133 of file Delaunay2dMesh.cpp.
References face, m_globalIterator, m_globalIteratorEnd, m_numberOfTriangles, m_triIndexes, Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.
Referenced by cloudViewer::PointProjectionTools::computeTriangulation(), DistanceMapGenerationTool::CreateMap(), define_Delaunay2dMesh(), TesselateContour(), and cloudViewer::Neighbourhood::triangulateOnPlane().
|
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 306 of file Delaunay2dMesh.cpp.
References cloudViewer::SimpleTriangle::A, cloudViewer::SimpleTriangle::B, cloudViewer::SimpleTriangle::C, cloudViewer::GenericIndexedCloud::getPoint(), m_associatedCloud, m_numberOfTriangles, and m_triIndexes.
|
inline |
Returns associated cloud.
Definition at line 111 of file Delaunay2dMesh.h.
Referenced by define_Delaunay2dMesh().
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 389 of file Delaunay2dMesh.cpp.
References cloudViewer::GenericCloud::getBoundingBox(), and m_associatedCloud.
|
overridevirtual |
Returns the indexes of the vertices of the next triangle (relatively to the global iterator position)
Implements cloudViewer::GenericIndexedMesh.
Definition at line 335 of file Delaunay2dMesh.cpp.
References cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, m_dumpTriangleIndexes, m_globalIterator, and m_globalIteratorEnd.
Referenced by DistanceMapGenerationTool::CreateMap().
|
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 358 of file Delaunay2dMesh.cpp.
References cloudViewer::GenericIndexedCloud::getPoint(), m_associatedCloud, m_numberOfTriangles, and m_triIndexes.
|
overridevirtual |
Implements cloudViewer::GenericIndexedMesh.
Definition at line 370 of file Delaunay2dMesh.cpp.
References cloudViewer::GenericIndexedCloud::getPoint(), m_associatedCloud, m_numberOfTriangles, and m_triIndexes.
|
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 382 of file Delaunay2dMesh.cpp.
References m_numberOfTriangles, and m_triIndexes.
|
inline |
Returns triangles indexes array (pointer to)
Handle with care!
Definition at line 102 of file Delaunay2dMesh.h.
Referenced by define_Delaunay2dMesh().
|
virtual |
Associate this mesh to a point cloud.
This particular mesh structure deals with point indexes instead of points. Therefore, it is possible to change the associated point cloud (if the new cloud has the same size). For example, it can be useful to compute the mesh on 2D points corresponding to 3D points that have been projected on a plane and then to link this structure with the 3D original points.
| aCloud | a point cloud |
| passOwnership | if true the Delaunay2dMesh destructor will delete the cloud as well |
Definition at line 52 of file Delaunay2dMesh.cpp.
References m_associatedCloud, and m_cloudIsOwnedByMesh.
Referenced by cloudViewer::PointProjectionTools::computeTriangulation(), define_Delaunay2dMesh(), cloudViewer::Neighbourhood::triangulateOnPlane(), and ~Delaunay2dMesh().
|
overridevirtual |
Places the mesh iterator at the beginning.
Virtual method to handle the mesh global iterator
Implements cloudViewer::GenericMesh.
Definition at line 320 of file Delaunay2dMesh.cpp.
References m_globalIterator, and m_triIndexes.
Referenced by DistanceMapGenerationTool::CreateMap().
|
virtual |
Removes the triangles falling outside of a given (2D) polygon.
| vertices2D | vertices of the mesh as 2D points (typically the one used to triangulate the mesh!) |
| polygon2D | vertices of the 2D boundary polygon (ordered) |
| removeOutside | whether to remove triangles outside (default) or inside |
Definition at line 207 of file Delaunay2dMesh.cpp.
References cloudViewer::ManualSegmentationTools::isPointInsidePoly(), m_associatedCloud, m_globalIterator, m_globalIteratorEnd, m_numberOfTriangles, m_triIndexes, and cloudViewer::GenericCloud::size().
Referenced by define_Delaunay2dMesh(), and TesselateContour().
| bool Delaunay2dMesh::removeTrianglesWithEdgesLongerThan | ( | PointCoordinateType | maxEdgeLength | ) |
Filters out the triangles based on their edge length.
Warning: may remove ALL triangles! Check the resulting size afterwards.
Definition at line 265 of file Delaunay2dMesh.cpp.
References cloudViewer::GenericIndexedCloud::getPoint(), m_associatedCloud, m_globalIterator, m_globalIteratorEnd, m_numberOfTriangles, and m_triIndexes.
Referenced by cloudViewer::PointProjectionTools::computeTriangulation(), define_Delaunay2dMesh(), and cloudViewer::Neighbourhood::triangulateOnPlane().
|
inlineoverridevirtual |
Returns the number of triangles.
Virtual method to request the mesh size
Implements cloudViewer::GenericMesh.
Definition at line 82 of file Delaunay2dMesh.h.
Referenced by cloudViewer::PointProjectionTools::computeTriangulation(), DistanceMapGenerationTool::CreateMap(), TesselateContour(), and cloudViewer::Neighbourhood::triangulateOnPlane().
|
static |
Tesselates a 2D polyline (shortcut to buildMesh and removeOuterTriangles)
Definition at line 397 of file Delaunay2dMesh.cpp.
References buildMesh(), count, Delaunay2dMesh(), removeOuterTriangles(), and size().
Referenced by define_Delaunay2dMesh(), and TesselateContour().
|
static |
Tesselates a 2D polyline (not necessarily axis-aligned)
Definition at line 429 of file Delaunay2dMesh.cpp.
References count, cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::Neighbourhood::projectPointsOn2DPlane(), cloudViewer::GenericCloud::size(), TesselateContour(), Tuple3Tpl< Type >::u, and X.
|
protected |
Associated point cloud.
Definition at line 126 of file Delaunay2dMesh.h.
Referenced by _getNextTriangle(), _getTriangle(), forEach(), getBoundingBox(), getTriangleVertices(), linkMeshWith(), removeOuterTriangles(), and removeTrianglesWithEdgesLongerThan().
|
protected |
Specifies if the associated cloud should be deleted when the mesh is deleted
Definition at line 142 of file Delaunay2dMesh.h.
Referenced by linkMeshWith().
|
protected |
Dump triangle structure to transmit temporary data.
Definition at line 145 of file Delaunay2dMesh.h.
Referenced by _getNextTriangle(), and _getTriangle().
|
protected |
Dump triangle index structure to transmit temporary data.
Definition at line 148 of file Delaunay2dMesh.h.
Referenced by getNextTriangleVertIndexes().
|
protected |
Iterator on the list of triangle vertex indexes.
Definition at line 132 of file Delaunay2dMesh.h.
Referenced by _getNextTriangle(), buildMesh(), getNextTriangleVertIndexes(), placeIteratorAtBeginning(), removeOuterTriangles(), and removeTrianglesWithEdgesLongerThan().
|
protected |
End position of global iterator.
Definition at line 135 of file Delaunay2dMesh.h.
Referenced by _getNextTriangle(), buildMesh(), getNextTriangleVertIndexes(), removeOuterTriangles(), and removeTrianglesWithEdgesLongerThan().
|
protected |
The number of triangles.
Definition at line 138 of file Delaunay2dMesh.h.
Referenced by _getTriangle(), buildMesh(), forEach(), getTriangleVertices(), getTriangleVertIndexes(), removeOuterTriangles(), and removeTrianglesWithEdgesLongerThan().
|
protected |
Triangle vertex indexes.
Definition at line 129 of file Delaunay2dMesh.h.
Referenced by _getTriangle(), buildMesh(), forEach(), getTriangleVertices(), getTriangleVertIndexes(), placeIteratorAtBeginning(), removeOuterTriangles(), removeTrianglesWithEdgesLongerThan(), and ~Delaunay2dMesh().
|
staticconstexpr |
Definition at line 26 of file Delaunay2dMesh.h.
Referenced by cloudViewer::PointProjectionTools::computeTriangulation(), DistanceMapGenerationTool::CreateMap(), define_Delaunay2dMesh(), and cloudViewer::Neighbourhood::triangulateOnPlane().