![]() |
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 | 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 class to compute and handle a Delaunay 2D mesh on a subset of points.
| Delaunay2dMesh::Delaunay2dMesh | ( | ) |
Delaunay2dMesh constructor.
Referenced by TesselateContour().
|
override |
Delaunay2dMesh destructor.
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.
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.
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.
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) |
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) |
References face, m_globalIterator, m_globalIteratorEnd, m_numberOfTriangles, m_triIndexes, Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.
Referenced by ccExtru::buildUp(), cloudViewer::PointProjectionTools::computeTriangulation(), DistanceMapGenerationTool::CreateMap(), define_Delaunay2dMesh(), ccRasterGrid::fillWith(), TesselateContour(), cloudViewer::Neighbourhood::triangulateOnPlane(), and ccMesh::TriangulateTwoPolylines().
|
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, cloudViewer::GenericIndexedCloud::getPoint(), m_associatedCloud, m_numberOfTriangles, and m_triIndexes.
|
inline |
Returns associated cloud.
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.
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.
References cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, m_dumpTriangleIndexes, m_globalIterator, and m_globalIteratorEnd.
Referenced by DistanceMapGenerationTool::CreateMap(), and ccRasterGrid::fillWith().
|
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(), m_associatedCloud, m_numberOfTriangles, and m_triIndexes.
|
overridevirtual |
Implements cloudViewer::GenericIndexedMesh.
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.
References m_numberOfTriangles, and m_triIndexes.
|
inline |
Returns triangles indexes array (pointer to)
Handle with care!
Referenced by ccExtru::buildUp(), define_Delaunay2dMesh(), and ObjFilter::loadFile().
|
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 |
References m_associatedCloud, and m_cloudIsOwnedByMesh.
Referenced by cloudViewer::PointProjectionTools::computeTriangulation(), define_Delaunay2dMesh(), cloudViewer::Neighbourhood::triangulateOnPlane(), ccMesh::TriangulateTwoPolylines(), and ~Delaunay2dMesh().
|
overridevirtual |
Places the mesh iterator at the beginning.
Virtual method to handle the mesh global iterator
Implements cloudViewer::GenericMesh.
References m_globalIterator, and m_triIndexes.
Referenced by DistanceMapGenerationTool::CreateMap(), and ccRasterGrid::fillWith().
|
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 |
References cloudViewer::ManualSegmentationTools::isPointInsidePoly(), m_associatedCloud, m_globalIterator, m_globalIteratorEnd, m_numberOfTriangles, m_triIndexes, and cloudViewer::GenericCloud::size().
Referenced by define_Delaunay2dMesh(), TesselateContour(), and ccMesh::TriangulateTwoPolylines().
| bool Delaunay2dMesh::removeTrianglesWithEdgesLongerThan | ( | PointCoordinateType | maxEdgeLength | ) |
Filters out the triangles based on their edge length.
Warning: may remove ALL triangles! Check the resulting size afterwards.
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.
Referenced by ccExtru::buildUp(), cloudViewer::PointProjectionTools::computeTriangulation(), DistanceMapGenerationTool::CreateMap(), ccRasterGrid::fillWith(), ObjFilter::loadFile(), TesselateContour(), cloudViewer::Neighbourhood::triangulateOnPlane(), and ccMesh::TriangulateTwoPolylines().
|
static |
Tesselates a 2D polyline (shortcut to buildMesh and removeOuterTriangles)
References buildMesh(), count, Delaunay2dMesh(), removeOuterTriangles(), and size().
Referenced by define_Delaunay2dMesh(), ObjFilter::loadFile(), and TesselateContour().
|
static |
Tesselates a 2D polyline (not necessarily axis-aligned)
References count, cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::Neighbourhood::projectPointsOn2DPlane(), cloudViewer::GenericCloud::size(), TesselateContour(), Tuple3Tpl< Type >::u, and X.
|
protected |
Associated point cloud.
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
Referenced by linkMeshWith().
|
protected |
Dump triangle structure to transmit temporary data.
Referenced by _getNextTriangle(), and _getTriangle().
|
protected |
Dump triangle index structure to transmit temporary data.
Referenced by getNextTriangleVertIndexes().
|
protected |
Iterator on the list of triangle vertex indexes.
Referenced by _getNextTriangle(), buildMesh(), getNextTriangleVertIndexes(), placeIteratorAtBeginning(), removeOuterTriangles(), and removeTrianglesWithEdgesLongerThan().
|
protected |
End position of global iterator.
Referenced by _getNextTriangle(), buildMesh(), getNextTriangleVertIndexes(), removeOuterTriangles(), and removeTrianglesWithEdgesLongerThan().
|
protected |
The number of triangles.
Referenced by _getTriangle(), buildMesh(), forEach(), getTriangleVertices(), getTriangleVertIndexes(), removeOuterTriangles(), and removeTrianglesWithEdgesLongerThan().
|
protected |
Triangle vertex indexes.
Referenced by _getTriangle(), buildMesh(), forEach(), getTriangleVertices(), getTriangleVertIndexes(), placeIteratorAtBeginning(), removeOuterTriangles(), removeTrianglesWithEdgesLongerThan(), and ~Delaunay2dMesh().
|
staticconstexpr |