ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::ManualSegmentationTools Class Reference

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

#include <ManualSegmentationTools.h>

Inheritance diagram for cloudViewer::ManualSegmentationTools:
Collaboration diagram for cloudViewer::ManualSegmentationTools:

Classes

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

Static Public Member Functions

static ReferenceCloudsegment (GenericIndexedCloudPersist *aCloud, const Polyline *poly, bool keepInside, const float *viewMat=nullptr)
 
static ReferenceCloudsegment (GenericIndexedCloudPersist *cloud, ScalarType minDist, ScalarType maxDist, bool outside=false)
 
static ReferenceCloudsegment (GenericIndexedCloudPersist *cloud, std::vector< ScalarType > values, bool outside=false)
 
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 *mesh, ReferenceCloud *selectedVertexIndexes, bool useSelectedVertices, GenericProgressCallback *progressCb=nullptr, GenericIndexedCloud *destCloud=nullptr, unsigned indexShift=0, std::vector< int > *triangleIndexMap=nullptr)
 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.)

Definition at line 24 of file ManualSegmentationTools.h.

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

Definition at line 61 of file ManualSegmentationTools.cpp.

References cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::GenericCloud::size(), Vector2Tpl< Type >::x, Tuple3Tpl< Type >::x, Vector2Tpl< Type >::y, and Tuple3Tpl< Type >::y.

Referenced by cloudViewer::Delaunay2dMesh::removeOuterTriangles(), ccGraphicalSegmentationTool::segment(), and segment().

◆ 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

Definition at line 90 of file ManualSegmentationTools.cpp.

References Vector2Tpl< Type >::x, and Vector2Tpl< Type >::y.

◆ segment() [1/3]

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)

Definition at line 22 of file ManualSegmentationTools.cpp.

References cloudViewer::ReferenceCloud::addPointIndex(), count, cloudViewer::GenericIndexedCloud::getPoint(), isPointInsidePoly(), cloudViewer::GenericCloud::size(), Tuple3Tpl< Type >::x, and Tuple3Tpl< Type >::y.

◆ segment() [2/3]

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)

Definition at line 115 of file ManualSegmentationTools.cpp.

References cloudViewer::ReferenceCloud::addPointIndex(), dist(), cloudViewer::GenericCloud::getPointScalarValue(), and cloudViewer::GenericCloud::size().

◆ segment() [3/3]

ReferenceCloud * cloudViewer::ManualSegmentationTools::segment ( GenericIndexedCloudPersist cloud,
std::vector< ScalarType >  values,
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
valuesscalar values
outsidewhether to select the points inside or outside
Returns
a new cloud structure containing the extracted points (references to - no duplication)

Definition at line 145 of file ManualSegmentationTools.cpp.

References abs(), cloudViewer::ReferenceCloud::addPointIndex(), dist(), EPSILON_VALUE, cloudViewer::GenericCloud::getPointScalarValue(), and cloudViewer::GenericCloud::size().

◆ segmentMesh()

GenericIndexedMesh * ManualSegmentationTools::segmentMesh ( GenericIndexedMesh mesh,
ReferenceCloud selectedVertexIndexes,
bool  useSelectedVertices,
GenericProgressCallback progressCb = nullptr,
GenericIndexedCloud destCloud = nullptr,
unsigned  indexShift = 0,
std::vector< int > *  triangleIndexMap = nullptr 
)
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 (useSelectedVertices = true)
  • or all the triangles for which no vertex is part of this subset (useSelectedVertices = false).
        \warning No re-triangulation on the border will occur.
    
        \param mesh a mesh
        \param selectedVertexIndexes the indexes of selected vertices
        \param useSelectedVertices specifies if the points corresponding to
    
    the input indexes should be the new mesh vertices, or the opposite
    Parameters
    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
    triangleIndexMapoptionally, a vector can be filled to record the new indexes of the triangles in the destination mesh (or -1 if they are discarded)
    Returns
    a new mesh structure, or 0 if something went wrong

Definition at line 182 of file ManualSegmentationTools.cpp.

References cloudViewer::SimpleMesh::addTriangle(), cloudViewer::SimpleMesh::capacity(), cloudViewer::ReferenceCloud::getAssociatedCloud(), cloudViewer::GenericIndexedMesh::getNextTriangleVertIndexes(), cloudViewer::ReferenceCloud::getPointGlobalIndex(), cloudViewer::VerticesIndexes::i, cloudViewer::NormalizedProgress::oneStep(), cloudViewer::GenericMesh::placeIteratorAtBeginning(), cloudViewer::SimpleMesh::reserve(), cloudViewer::SimpleMesh::resize(), cloudViewer::GenericProgressCallback::setInfo(), cloudViewer::GenericProgressCallback::setMethodTitle(), cloudViewer::GenericCloud::size(), cloudViewer::GenericMesh::size(), cloudViewer::ReferenceCloud::size(), cloudViewer::SimpleMesh::size(), size, cloudViewer::GenericProgressCallback::start(), cloudViewer::GenericProgressCallback::textCanBeEdited(), and cloudViewer::GenericProgressCallback::update().

◆ segmentMeshWithAABox()

bool ManualSegmentationTools::segmentMeshWithAABox ( GenericIndexedMesh mesh,
GenericIndexedCloudPersist vertices,
MeshCutterParams ioParams,
GenericProgressCallback progressCb = nullptr 
)
static

Definition at line 887 of file ManualSegmentationTools.cpp.

References abs(), AddTriangle(), cloudViewer::ManualSegmentationTools::MeshCutterParams::bbMax, cloudViewer::ManualSegmentationTools::MeshCutterParams::bbMin, c_origIndexFlag, c_realIndexMask, c_srcIndexFlag, cloudViewer::SimpleMesh::clear(), ComputeEdgePoint(), cloudViewer::ManualSegmentationTools::MeshCutterParams::epsilon, error(), Vector3Tpl< double >::fromArray(), cloudViewer::ManualSegmentationTools::MeshCutterParams::generateOutsideMesh, cloudViewer::GenericIndexedMesh::getTriangleVertIndexes(), cloudViewer::VerticesIndexes::i1, cloudViewer::VerticesIndexes::i2, cloudViewer::VerticesIndexes::i3, ImportSourceVertices(), cloudViewer::ManualSegmentationTools::MeshCutterParams::insideMesh, MergeOldTriangles(), cloudViewer::ManualSegmentationTools::MeshCutterParams::origTriIndexesMapInside, cloudViewer::ManualSegmentationTools::MeshCutterParams::origTriIndexesMapOutside, cloudViewer::ManualSegmentationTools::MeshCutterParams::outsideMesh, cloudViewer::PointCloudTpl< T >::reset(), cloudViewer::SimpleMesh::resize(), cloudViewer::PointCloud::resize(), s_edgePoint, cloudViewer::GenericCloud::size(), cloudViewer::GenericMesh::size(), cloudViewer::SimpleMesh::size(), size, std::swap(), cloudViewer::ManualSegmentationTools::MeshCutterParams::trackOrigIndexes, cloudViewer::CCMiscTools::TriBoxOverlapd(), Tuple3Tpl< Type >::u, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by ccCropTool::Crop().

◆ segmentMeshWithAAPlane()


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