CCCoreLib 31 May 2022
CloudCompare Core algorithms
Classes | Static Public Member Functions | List of all members
CCCoreLib::ManualSegmentationTools Class Reference

Manual segmentation algorithms (inside/outside a polyline, etc.) More...

#include <ManualSegmentationTools.h>

Inheritance diagram for CCCoreLib::ManualSegmentationTools:
Inheritance graph
[legend]
Collaboration diagram for CCCoreLib::ManualSegmentationTools:
Collaboration graph
[legend]

Classes

struct  MeshCutterParams
 Input/output parameters for the segmentMeshWitAAPlane method. More...
 

Static Public Member Functions

static ReferenceCloudsegment (GenericIndexedCloudPersist *aCloud, const Polyline *poly, bool keepInside, const float *viewMat=nullptr)
 Extracts the points that fall inside/outside of a 2D polyline once projected on the screen. More...
 
static ReferenceCloudsegmentReferenceCloud (ReferenceCloud *cloud, ScalarType minDist, ScalarType maxDist, bool outside)
 Selects the points which associated scalar value fall inside or outside a specified interval. More...
 
static ReferenceCloudsegment (GenericIndexedCloudPersist *cloud, ScalarType minDist, ScalarType maxDist, bool outside=false)
 Selects the points which associated scalar value fall inside or outside a specified interval. More...
 
static bool isPointInsidePoly (const CCVector2 &P, const GenericIndexedCloud *polyVertices)
 Tests if a point is inside a polygon (2D) More...
 
static bool isPointInsidePoly (const CCVector2 &P, const std::vector< CCVector2 > &polyVertices)
 Tests if a point is inside a polygon (2D) More...
 
static GenericIndexedMeshsegmentMesh (GenericIndexedMesh *theMesh, ReferenceCloud *pointsIndexes, bool pointsWillBeInside, GenericProgressCallback *progressCb=nullptr, GenericIndexedCloud *destCloud=nullptr, unsigned indexShift=0)
 Segments a mesh knowing which vertices should be kept or not. More...
 
static bool segmentMeshWithAAPlane (GenericIndexedMesh *mesh, GenericIndexedCloudPersist *vertices, MeshCutterParams &ioParams, GenericProgressCallback *progressCb=nullptr)
 
static bool segmentMeshWithAABox (GenericIndexedMesh *mesh, GenericIndexedCloudPersist *vertices, MeshCutterParams &ioParams, GenericProgressCallback *progressCb=nullptr)
 

Detailed Description

Manual segmentation algorithms (inside/outside a polyline, etc.)

Member Function Documentation

◆ isPointInsidePoly() [1/2]

bool ManualSegmentationTools::isPointInsidePoly ( const CCVector2 P,
const GenericIndexedCloud polyVertices 
)
static

Tests if a point is inside a polygon (2D)

Parameters
Pa 2D point
polyVerticespolygon vertices (considered as ordered 2D poyline vertices)
Returns
true if P is inside poly

◆ isPointInsidePoly() [2/2]

bool ManualSegmentationTools::isPointInsidePoly ( const CCVector2 P,
const std::vector< CCVector2 > &  polyVertices 
)
static

Tests if a point is inside a polygon (2D)

Parameters
Pa 2D point
polyVerticespolygon vertices (considered as ordered 2D poyline vertices)
Returns
true if P is inside poly

◆ segment() [1/2]

ReferenceCloud * ManualSegmentationTools::segment ( GenericIndexedCloudPersist aCloud,
const Polyline poly,
bool  keepInside,
const float *  viewMat = nullptr 
)
static

Extracts the points that fall inside/outside of a 2D polyline once projected on the screen.

The camera parameters of the screen must be transmitted to this method, as well as the polyline (generally drawn on the screen by a user) expressed in the screen coordinates.

Parameters
aCloudthe cloud to segment
polythe polyline
keepInsideif true (resp. false), the points falling inside (resp. outside) the polyline will be extracted
viewMatthe optional 4x4 visualization matrix (OpenGL style)
Returns
a cloud structure containing references to the extracted points (references to - no duplication)

◆ segment() [2/2]

ReferenceCloud * ManualSegmentationTools::segment ( GenericIndexedCloudPersist cloud,
ScalarType  minDist,
ScalarType  maxDist,
bool  outside = false 
)
static

Selects the points which associated scalar value fall inside or outside a specified interval.

Warning
: be sure to activate an OUTPUT scalar field on the input cloud
Parameters
cloudthe cloud to segment
minDistthe lower boundary
maxDistthe upper boundary
outsidewhether to select the points inside or outside
Returns
a new cloud structure containing the extracted points (references to - no duplication)

◆ segmentMesh()

GenericIndexedMesh * ManualSegmentationTools::segmentMesh ( GenericIndexedMesh theMesh,
ReferenceCloud pointsIndexes,
bool  pointsWillBeInside,
GenericProgressCallback progressCb = nullptr,
GenericIndexedCloud destCloud = nullptr,
unsigned  indexShift = 0 
)
static

Segments a mesh knowing which vertices should be kept or not.

This method takes as input a set of vertex indexes and creates a new mesh composed either of:

  • the triangles that have exactly those points as vertices (pointsWillBeInside = true)
  • or all the triangles for which no vertices are part of this subset (pointsWillBeInside = false).
Warning
No re-triangulation on the border will occur.
Parameters
theMesha mesh
pointsIndexesthe vertices indexes as a set of references
pointsWillBeInsidespecifies if the points corresponding to the input indexes should be the new mesh vertices, or the opposite
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
destCloudoptionally, a cloud object can be specified to be associated to the new created mesh object, instead of the cloud associated to the ReferenceCloud "pointsIndexes"
indexShiftoptionally, a shift can be added to all vertex indexes of the new mesh
Returns
a new mesh structure, or 0 if something went wrong

◆ segmentReferenceCloud()

ReferenceCloud * ManualSegmentationTools::segmentReferenceCloud ( ReferenceCloud cloud,
ScalarType  minDist,
ScalarType  maxDist,
bool  outside 
)
static

Selects the points which associated scalar value fall inside or outside a specified interval.

Warning
: be sure to activate an OUTPUT scalar field on the input cloud
Parameters
cloudthe RefrenceCloud to segment
minDistthe lower boundary
maxDistthe upper boundary
outsidewhether to select the points inside or outside
Returns
a new cloud structure containing the extracted points (references to - no duplication)

The documentation for this class was generated from the following files: