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

#include <DistanceComputationTools.h>

Inheritance diagram for cloudViewer::DistanceComputationTools:
Collaboration diagram for cloudViewer::DistanceComputationTools:

Classes

struct  Cloud2CloudDistancesComputationParams
 Cloud-to-cloud "Hausdorff" distance computation parameters. More...
 
struct  Cloud2MeshDistancesComputationParams
 Cloud-to-mes distances computation parameters. More...
 

Public Types

enum  ERROR_MEASURES {
  RMS , MAX_DIST_68_PERCENT , MAX_DIST_95_PERCENT , MAX_DIST_99_PERCENT ,
  MAX_DIST
}
 Error estimators. More...
 
enum  DISTANCE_COMPUTATION_RESULTS {
  CANCELED_BY_USER = -1000 , ERROR_NULL_COMPAREDCLOUD , ERROR_NULL_COMPAREDOCTREE , ERROR_OUT_OF_MEMORY ,
  ERROR_ENABLE_SCALAR_FIELD_FAILURE , ERROR_EMPTY_COMPAREDCLOUD , ERROR_NULL_REFERENCECLOUD , ERROR_EMPTY_REFERENCECLOUD ,
  ERROR_NULL_REFERENCEMESH , ERROR_EMPTY_REFERENCEMESH , ERROR_NULL_REFERENCEPOLYLINE , ERROR_TOOSMALL_REFERENCEPOLYLINE ,
  NULL_PLANE_EQUATION , ERROR_NULL_OCTREE , ERROR_INVALID_OCTREE_AND_MESH_INTERSECTION , ERROR_OCTREE_AND_MESH_INTERSECTION_MISMATCH ,
  ERROR_CANT_USE_MAX_SEARCH_DIST_AND_CLOSEST_POINT_SET , ERROR_EXECUTE_FUNCTION_FOR_ALL_CELLS_AT_LEVEL_FAILURE , ERROR_EXECUTE_GET_POINTS_IN_CELL_BY_INDEX_FAILURE , ERROR_EXECUTE_CLOUD_MESH_DIST_CELL_FUNC_MT_FAILURE ,
  ERROR_GET_CELL_CODES_FAILURE , ERROR_GET_CELL_CODES_AND_INDEXES_FAILURE , ERROR_GET_CELL_INDEXES_FAILURE , ERROR_PROPAGATE_DISTANCE_FAILURE ,
  ERROR_SEED_POINT_INDEX_GREATER_THAN_COMPAREDCLOUD_SIZE , ERROR_INIT_DISTANCE_TRANSFORM_GRID_FAILURE , ERROR_INIT_PER_CELL_TRIANGLE_LIST_FAILURE , ERROR_INTERSECT_MESH_WITH_OCTREE_FAILURE ,
  ERROR_COMPUTE_CLOUD2_MESH_DISTANCE_WITH_OCTREE_FAILURE , ERROR_COMPUTE_CLOUD2_CLOUD_DISTANCE_FAILURE , ERROR_OCTREE_LEVEL_LT_ONE , ERROR_OCTREE_LEVEL_GT_MAX_OCTREE_LEVEL ,
  ERROR_SYNCHRONIZE_OCTREES_FAILURE , ERROR_PLANE_NORMAL_LT_ZERO , ERROR_INVALID_PRIMITIVE_DIMENSIONS , ERROR_CONE_R1_LT_CONE_R2 ,
  ERROR_CONELENGTH_ZERO , ERROR_COULDNOT_SYNCRONIZE_OCTREES , ERROR_BUILD_OCTREE_FAILURE , ERROR_BUILD_FAST_MARCHING_FAILURE ,
  ERROR_UNKOWN_ERRORMEASURES_TYPE , ERROR_INTERNAL , INVALID_INPUT , SUCCESS = 1
}
 
enum  SOReturnCode { EMPTY_CLOUD , SYNCHRONIZED , DISJOINT , OUT_OF_MEMORY }
 Return codes for DistanceComputationTools::synchronizeOctrees. More...
 

Static Public Member Functions

static int computeCloud2CloudDistances (GenericIndexedCloudPersist *comparedCloud, GenericIndexedCloudPersist *referenceCloud, Cloud2CloudDistancesComputationParams &params, GenericProgressCallback *progressCb=nullptr, DgmOctree *compOctree=nullptr, DgmOctree *refOctree=nullptr)
 
static int computeCloud2MeshDistances (GenericIndexedCloudPersist *pointCloud, GenericIndexedMesh *mesh, Cloud2MeshDistancesComputationParams &params, GenericProgressCallback *progressCb=nullptr, DgmOctree *cloudOctree=nullptr)
 Computes the distance between a point cloud and a mesh. More...
 
static int computeApproxCloud2CloudDistance (GenericIndexedCloudPersist *comparedCloud, GenericIndexedCloudPersist *referenceCloud, unsigned char octreeLevel, PointCoordinateType maxSearchDist=0, GenericProgressCallback *progressCb=nullptr, DgmOctree *compOctree=nullptr, DgmOctree *refOctree=nullptr)
 Computes approximate distances between two point clouds. More...
 
static ScalarType computePoint2TriangleDistance (const CCVector3 *P, const GenericTriangle *theTriangle, bool signedDist, CCVector3 *nearestP=nullptr)
 Computes the distance between a point and a triangle. More...
 
static ScalarType computePoint2PlaneDistance (const CCVector3 *P, const PointCoordinateType *planeEquation)
 Computes the (signed) distance between a point and a plane. More...
 
static ScalarType computePoint2LineSegmentDistSquared (const CCVector3 *point, const CCVector3 *start, const CCVector3 *end)
 Computes the square of the distance between a point and a line segment. More...
 
static int computeCloud2ConeEquation (GenericIndexedCloudPersist *cloud, const CCVector3 &coneP1, const CCVector3 &coneP2, const PointCoordinateType coneR1, const PointCoordinateType coneR2, bool signedDistances=true, bool solutionType=false, double *rms=nullptr)
 Computes the distance between each point in a cloud and a cone. More...
 
static int computeCloud2CylinderEquation (GenericIndexedCloudPersist *cloud, const CCVector3 &cylinderP1, const CCVector3 &cylinderP2, const PointCoordinateType cylinderRadius, bool signedDistances=true, bool solutionType=false, double *rms=nullptr)
 Computes the distance between each point in a cloud and a cylinder. More...
 
static int computeCloud2SphereEquation (GenericIndexedCloudPersist *cloud, const CCVector3 &sphereCenter, const PointCoordinateType sphereRadius, bool signedDistances=true, double *rms=nullptr)
 Computes the distance between each point in a cloud and a sphere. More...
 
static int computeCloud2DiscEquation (GenericIndexedCloudPersist *cloud, const CCVector3 &discCenter, const PointCoordinateType discRadius, const SquareMatrix &rotationTransform, bool signedDistances=true, double *rms=nullptr)
 Computes the distance between each point in a cloud and a disc. More...
 
static int computeCloud2PlaneEquation (GenericIndexedCloudPersist *cloud, const PointCoordinateType *planeEquation, bool signedDistances=true, double *rms=nullptr)
 Computes the distance between each point in a cloud and a plane. More...
 
static int computeCloud2RectangleEquation (GenericIndexedCloudPersist *cloud, PointCoordinateType widthX, PointCoordinateType widthY, const SquareMatrix &rotationTransform, const CCVector3 &center, bool signedDist=true, double *rms=nullptr)
 
static int computeCloud2BoxEquation (GenericIndexedCloudPersist *cloud, const CCVector3 &boxDimensions, const SquareMatrix &rotationTransform, const CCVector3 &boxCenter, bool signedDist=true, double *rms=nullptr)
 
static int computeCloud2PolylineEquation (GenericIndexedCloudPersist *cloud, const Polyline *polyline, double *rms=nullptr)
 Computes the distance between each point in a cloud and a polyline. More...
 
static ScalarType ComputeCloud2PlaneDistance (cloudViewer::GenericCloud *cloud, const PointCoordinateType *planeEquation, ERROR_MEASURES measureType)
 
static ScalarType ComputeCloud2PlaneRobustMax (GenericCloud *cloud, const PointCoordinateType *planeEquation, float percent)
 Computes the maximum distance between a point cloud and a plane. More...
 
static ScalarType ComputeCloud2PlaneMaxDistance (GenericCloud *cloud, const PointCoordinateType *planeEquation)
 Computes the maximum distance between a point cloud and a plane. More...
 
static ScalarType computeCloud2PlaneDistanceRMS (GenericCloud *cloud, const PointCoordinateType *planeEquation)
 Computes the Root Mean Square (RMS) distance between a cloud and a plane. More...
 
static PointCoordinateType ComputeSquareDistToSegment (const CCVector2 &P, const CCVector2 &A, const CCVector2 &B, bool onlyOrthogonal=false)
 Returns the (squared) distance from a point to a segment. More...
 
static bool computeGeodesicDistances (GenericIndexedCloudPersist *cloud, unsigned seedPointIndex, unsigned char octreeLevel, GenericProgressCallback *progressCb=nullptr)
 
static int diff (GenericIndexedCloudPersist *comparedCloud, GenericIndexedCloudPersist *referenceCloud, GenericProgressCallback *progressCb=nullptr)
 
static SOReturnCode synchronizeOctrees (GenericIndexedCloudPersist *comparedCloud, GenericIndexedCloudPersist *referenceCloud, DgmOctree *&comparedOctree, DgmOctree *&referenceOctree, PointCoordinateType maxSearchDist=0, GenericProgressCallback *progressCb=nullptr)
 Synchronizes (and re-build if necessary) two octrees. More...
 
static bool MultiThreadSupport ()
 

Static Protected Member Functions

static int intersectMeshWithOctree (OctreeAndMeshIntersection *theIntersection, unsigned char octreeLevel, GenericProgressCallback *progressCb=nullptr)
 Intersects a mesh with a grid structure. More...
 
static int computeCloud2MeshDistanceWithOctree (OctreeAndMeshIntersection *theIntersection, Cloud2MeshDistancesComputationParams &params, GenericProgressCallback *progressCb=nullptr)
 
static int computeCloud2MeshDistancesWithOctree (const DgmOctree *octree, OctreeAndMeshIntersection *intersection, Cloud2MeshDistancesComputationParams &params, GenericProgressCallback *progressCb=nullptr)
 
static int computePoint2MeshDistancesWithOctree (const CCVector3 &P, ScalarType &distance, OctreeAndMeshIntersection *intersection, Cloud2MeshDistancesComputationParams &params)
 
static bool computeCellHausdorffDistance (const DgmOctree::octreeCell &cell, void **additionalParameters, NormalizedProgress *nProgress=nullptr)
 
static bool computeCellHausdorffDistanceWithLocalModel (const DgmOctree::octreeCell &cell, void **additionalParameters, NormalizedProgress *nProgress=nullptr)
 

Detailed Description

Several entity-to-entity distances computation algorithms (cloud-cloud, cloud-mesh, point-triangle, etc.)

Definition at line 31 of file DistanceComputationTools.h.

Member Enumeration Documentation

◆ DISTANCE_COMPUTATION_RESULTS

Enumerator
CANCELED_BY_USER 
ERROR_NULL_COMPAREDCLOUD 
ERROR_NULL_COMPAREDOCTREE 
ERROR_OUT_OF_MEMORY 
ERROR_ENABLE_SCALAR_FIELD_FAILURE 
ERROR_EMPTY_COMPAREDCLOUD 
ERROR_NULL_REFERENCECLOUD 
ERROR_EMPTY_REFERENCECLOUD 
ERROR_NULL_REFERENCEMESH 
ERROR_EMPTY_REFERENCEMESH 
ERROR_NULL_REFERENCEPOLYLINE 
ERROR_TOOSMALL_REFERENCEPOLYLINE 
NULL_PLANE_EQUATION 
ERROR_NULL_OCTREE 
ERROR_INVALID_OCTREE_AND_MESH_INTERSECTION 
ERROR_OCTREE_AND_MESH_INTERSECTION_MISMATCH 
ERROR_CANT_USE_MAX_SEARCH_DIST_AND_CLOSEST_POINT_SET 
ERROR_EXECUTE_FUNCTION_FOR_ALL_CELLS_AT_LEVEL_FAILURE 
ERROR_EXECUTE_GET_POINTS_IN_CELL_BY_INDEX_FAILURE 
ERROR_EXECUTE_CLOUD_MESH_DIST_CELL_FUNC_MT_FAILURE 
ERROR_GET_CELL_CODES_FAILURE 
ERROR_GET_CELL_CODES_AND_INDEXES_FAILURE 
ERROR_GET_CELL_INDEXES_FAILURE 
ERROR_PROPAGATE_DISTANCE_FAILURE 
ERROR_SEED_POINT_INDEX_GREATER_THAN_COMPAREDCLOUD_SIZE 
ERROR_INIT_DISTANCE_TRANSFORM_GRID_FAILURE 
ERROR_INIT_PER_CELL_TRIANGLE_LIST_FAILURE 
ERROR_INTERSECT_MESH_WITH_OCTREE_FAILURE 
ERROR_COMPUTE_CLOUD2_MESH_DISTANCE_WITH_OCTREE_FAILURE 
ERROR_COMPUTE_CLOUD2_CLOUD_DISTANCE_FAILURE 
ERROR_OCTREE_LEVEL_LT_ONE 
ERROR_OCTREE_LEVEL_GT_MAX_OCTREE_LEVEL 
ERROR_SYNCHRONIZE_OCTREES_FAILURE 
ERROR_PLANE_NORMAL_LT_ZERO 
ERROR_INVALID_PRIMITIVE_DIMENSIONS 
ERROR_CONE_R1_LT_CONE_R2 
ERROR_CONELENGTH_ZERO 
ERROR_COULDNOT_SYNCRONIZE_OCTREES 
ERROR_BUILD_OCTREE_FAILURE 
ERROR_BUILD_FAST_MARCHING_FAILURE 
ERROR_UNKOWN_ERRORMEASURES_TYPE 
ERROR_INTERNAL 
INVALID_INPUT 
SUCCESS 

Definition at line 418 of file DistanceComputationTools.h.

◆ ERROR_MEASURES

Error estimators.

Enumerator
RMS 

Root Mean Square error

MAX_DIST_68_PERCENT 

Max distance @ 68% (1 sigma)

MAX_DIST_95_PERCENT 

Max distance @ 98% (2 sigmas)

MAX_DIST_99_PERCENT 

Max distance @ 99% (3 sigmas)

MAX_DIST 

Max distance

Definition at line 410 of file DistanceComputationTools.h.

◆ SOReturnCode

Return codes for DistanceComputationTools::synchronizeOctrees.

Enumerator
EMPTY_CLOUD 
SYNCHRONIZED 
DISJOINT 
OUT_OF_MEMORY 

Definition at line 563 of file DistanceComputationTools.h.

Member Function Documentation

◆ computeApproxCloud2CloudDistance()

int DistanceComputationTools::computeApproxCloud2CloudDistance ( GenericIndexedCloudPersist comparedCloud,
GenericIndexedCloudPersist referenceCloud,
unsigned char  octreeLevel,
PointCoordinateType  maxSearchDist = 0,
GenericProgressCallback progressCb = nullptr,
DgmOctree compOctree = nullptr,
DgmOctree refOctree = nullptr 
)
static

Computes approximate distances between two point clouds.

This methods uses an exact Distance Transform to approximate the real distances. Therefore, the greater the octree level is (it is used to determine the grid step), the finer the result will be (but more memory and time will be needed).

Parameters
comparedCloudthe compared cloud
referenceCloudthe reference cloud
octreeLevelthe octree level at which to compute the Distance Transform
maxSearchDistmax search distance (or any negative value if no max distance is defined)
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
compOctreethe pre-computed octree of the compared cloud (warning: both octrees must have the same cubical bounding-box - it is automatically computed if 0)
refOctreethe pre-computed octree of the reference cloud (warning: both octrees must have the same cubical bounding-box - it is automatically computed if 0)
Returns
negative error code or a positive value in case of success

Definition at line 3754 of file DistanceComputationTools.cpp.

References cloudViewer::DgmOctree::associatedCloud(), cloudViewer::GenericCloud::enableScalarField(), cloudViewer::DgmOctree::getCellCode(), cloudViewer::DgmOctree::getCellCodes(), cloudViewer::DgmOctree::getCellIndexes(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::DgmOctree::getCellSize(), cloudViewer::DgmOctree::getMaxFillIndexes(), cloudViewer::DgmOctree::getMinFillIndexes(), cloudViewer::DgmOctree::getPointsInCellByCellIndex(), cloudViewer::Grid3D< Type >::getValue(), cloudViewer::SaitoSquaredDistanceTransform::initGrid(), max(), cloudViewer::DgmOctree::MAX_OCTREE_LEVEL, min(), octreeLevel, cloudViewer::SaitoSquaredDistanceTransform::propagateDistance(), result, cloudViewer::ReferenceCloud::setPointScalarValue(), cloudViewer::GenericCloud::setPointScalarValue(), cloudViewer::Grid3D< Type >::setValue(), cloudViewer::GenericCloud::size(), cloudViewer::ReferenceCloud::size(), SYNCHRONIZED, synchronizeOctrees(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by ccComparisonDlg::computeApproxDistances(), and ccRegistrationTools::ICP().

◆ computeCellHausdorffDistance()

bool DistanceComputationTools::computeCellHausdorffDistance ( const DgmOctree::octreeCell cell,
void **  additionalParameters,
NormalizedProgress nProgress = nullptr 
)
staticprotected

Computes the "nearest neighbour distance" without local modeling for all points of an octree cell This method has the generic syntax of a "cellular function" (see DgmOctree::localFunctionPtr). Specific parameters are transmitted via the "additionalParameters" structure. There are 3 additional parameters :

  • (GenericCloud*) the compared cloud
  • (GenericCloud*) the reference cloud
  • (DgmOctree*) the octree corresponding to the compared cloud
    Parameters
    cellstructure describing the cell on which processing is applied
    additionalParameterssee method description
    nProgressoptional (normalized) progress notification (per-point)

Definition at line 370 of file DistanceComputationTools.cpp.

References cloudViewer::DgmOctree::NearestNeighboursSearchStruct::alreadyVisitedNeighbourhoodSize, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellCenter, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellPos, cloudViewer::DgmOctree::computeCellCenter(), dist(), cloudViewer::DgmOctree::findTheNearestNeighborStartingFromCell(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::ReferenceCloud::getPoint(), cloudViewer::ReferenceCloud::getPointGlobalIndex(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::level, cloudViewer::DgmOctree::octreeCell::level, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::maxSearchSquareDistd, NAN_VALUE, nProgress, cloudViewer::NormalizedProgress::oneStep(), params, POINT_VISIBLE, cloudViewer::DgmOctree::octreeCell::points, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::queryPoint, cloudViewer::ReferenceCloud::setPointScalarValue(), cloudViewer::ReferenceCloud::size(), cloudViewer::GenericCloud::testVisibility(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::theNearestPointIndex, cloudViewer::DgmOctree::octreeCell::truncatedCode, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by computeCloud2CloudDistances().

◆ computeCellHausdorffDistanceWithLocalModel()

bool DistanceComputationTools::computeCellHausdorffDistanceWithLocalModel ( const DgmOctree::octreeCell cell,
void **  additionalParameters,
NormalizedProgress nProgress = nullptr 
)
staticprotected

Computes the "nearest neighbour distance" with local modeling for all points of an octree cell This method has the generic syntax of a "cellular function" (see DgmOctree::localFunctionPtr). Specific parameters are transmitted via the "additionalParameters" structure. There are 4 additional parameters :

  • (GenericCloud*) the compared cloud
  • (GenericCloud*) the reference cloud
  • (DgmOctree*) the octree corresponding to the compared cloud
  • (CC_LOCAL_MODEL_TYPES*) type of local model to apply
    Parameters
    cellstructure describing the cell on which processing is applied
    additionalParameterssee method description
    nProgressoptional (normalized) progress notification (per-point)

Definition at line 466 of file DistanceComputationTools.cpp.

References cloudViewer::DgmOctree::NearestNeighboursSearchStruct::alreadyVisitedNeighbourhoodSize, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellCenter, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::cellPos, cloudViewer::DgmOctree::computeCellCenter(), cloudViewer::LocalModel::computeDistanceFromModelToPoint(), CV_LOCAL_MODEL_MIN_SIZE, cloudViewer::DgmOctree::findNearestNeighborsStartingFromCell(), cloudViewer::DgmOctree::findNeighborsInASphereStartingFromCell(), cloudViewer::DgmOctree::findTheNearestNeighborStartingFromCell(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::DgmOctree::getCellSize(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::ReferenceCloud::getPoint(), cloudViewer::ReferenceCloud::getPointGlobalIndex(), cloudViewer::DgmOctree::getTheCellPosWhichIncludesThePoint(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::level, cloudViewer::DgmOctree::octreeCell::level, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::maxSearchSquareDistd, min(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::minimalCellsSetToVisit, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::minNumberOfNeighbors, NAN_VALUE, cloudViewer::LocalModel::New(), NO_MODEL, nProgress, cloudViewer::NormalizedProgress::oneStep(), params, cloudViewer::DgmOctree::octreeCell::parentOctree, POINT_VISIBLE, cloudViewer::DgmOctree::octreeCell::points, cloudViewer::DgmOctree::NearestNeighboursSearchStruct::pointsInNeighbourhood, cloudViewer::DgmOctree::NearestNeighboursSphericalSearchStruct::prepare(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::queryPoint, cloudViewer::ReferenceCloud::setPointScalarValue(), cloudViewer::ReferenceCloud::size(), cloudViewer::GenericCloud::testVisibility(), cloudViewer::DgmOctree::NearestNeighboursSearchStruct::theNearestPointIndex, cloudViewer::DgmOctree::octreeCell::truncatedCode, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by computeCloud2CloudDistances().

◆ computeCloud2BoxEquation()

int DistanceComputationTools::computeCloud2BoxEquation ( GenericIndexedCloudPersist cloud,
const CCVector3 boxDimensions,
const SquareMatrix rotationTransform,
const CCVector3 boxCenter,
bool  signedDist = true,
double *  rms = nullptr 
)
static

◆ computeCloud2CloudDistances()

int DistanceComputationTools::computeCloud2CloudDistances ( GenericIndexedCloudPersist comparedCloud,
GenericIndexedCloudPersist referenceCloud,
Cloud2CloudDistancesComputationParams params,
GenericProgressCallback progressCb = nullptr,
DgmOctree compOctree = nullptr,
DgmOctree refOctree = nullptr 
)
static

Computes the "nearest neighbour distance" between two point clouds (formerly named "Hausdorff distance") The main algorithm and its different versions (with or without local modeling) are described in Daniel Girardeau-Montaut's PhD manuscript (Chapter 2, section 2.3). It is the standard way to compare directly two dense (and globally close) point clouds.

Warning
The current scalar field of the compared cloud should be enabled. By default it will be reset to NAN_VALUE but one can avoid this by defining the Cloud2CloudDistancesComputationParams::resetFormerDistances parameters to false. But even in this case, only values above Cloud2CloudDistancesComputationParams::maxSearchDist will remain untouched.
Max search distance (Cloud2CloudDistancesComputationParams::maxSearchDist > 0) is not compatible with the determination of the Closest Point Set (Cloud2CloudDistancesComputationParams::CPSet)
Parameters
comparedCloudthe compared cloud (the distances will be computed on these points)
referenceCloudthe reference cloud (the distances will be computed relatively to these points)
paramsdistance computation parameters
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
compOctreethe pre-computed octree of the compared cloud (warning: both octrees must have the same cubical bounding-box - it is automatically computed if 0)
refOctreethe pre-computed octree of the reference cloud (warning: both octrees must have the same cubical bounding-box - it is automatically computed if 0)
Returns
0 if ok, a negative value otherwise

Definition at line 112 of file DistanceComputationTools.cpp.

References computeCellHausdorffDistance(), computeCellHausdorffDistanceWithLocalModel(), DISJOINT, cloudViewer::GenericCloud::enableScalarField(), cloudViewer::DgmOctree::executeFunctionForAllCellsAtLevel(), cloudViewer::DgmOctree::findBestLevelForComparisonWithOctree(), NAN_VALUE, NO_MODEL, params, result, cloudViewer::GenericCloud::setPointScalarValue(), cloudViewer::GenericCloud::size(), SYNCHRONIZED, and synchronizeOctrees().

Referenced by ccComparisonDlg::computeDistances(), diff(), KNNRegions(), CommandCPS::process(), and cloudViewer::ICPRegistrationTools::Register().

◆ computeCloud2ConeEquation()

int DistanceComputationTools::computeCloud2ConeEquation ( GenericIndexedCloudPersist cloud,
const CCVector3 coneP1,
const CCVector3 coneP2,
const PointCoordinateType  coneR1,
const PointCoordinateType  coneR2,
bool  signedDistances = true,
bool  solutionType = false,
double *  rms = nullptr 
)
static

Computes the distance between each point in a cloud and a cone.

Parameters
clouda 3D point cloud
coneP1center point associated with the larger radii
coneP2center point associated with the smaller radii
coneR1cone radius at coneP1 (larger)
coneR2cone radius at coneP2 (smaller)
signedDistwhether to compute the signed or positive (absolute) distance (optional)
solutionTypeif true the scalar field will be set to which solution was selected 1-4 (optional)
[out]rmswill be set with the Root Mean Square (RMS) distance between a cloud and a cylinder (optional)
Returns
negative error code or a positive value in case of success

Definition at line 2899 of file DistanceComputationTools.cpp.

References abs(), count, Vector3Tpl< Type >::dot(), cloudViewer::GenericCloud::enableScalarField(), cloudViewer::GenericIndexedCloud::getPoint(), min(), Vector3Tpl< Type >::norm2d(), Vector3Tpl< Type >::normalize(), Vector3Tpl< Type >::normd(), cloudViewer::GenericCloud::setPointScalarValue(), and cloudViewer::GenericCloud::size().

◆ computeCloud2CylinderEquation()

int DistanceComputationTools::computeCloud2CylinderEquation ( GenericIndexedCloudPersist cloud,
const CCVector3 cylinderP1,
const CCVector3 cylinderP2,
const PointCoordinateType  cylinderRadius,
bool  signedDistances = true,
bool  solutionType = false,
double *  rms = nullptr 
)
static

Computes the distance between each point in a cloud and a cylinder.

Parameters
clouda 3D point cloud
cylinderP1center bottom point
cylinderP2center top point
cylinderRadiuscylinder radius
signedDistwhether to compute the signed or positive (absolute) distance (optional)
solutionTypeif true the scalar field will be set to which solution was selected 1-4 (optional)
[out]rmswill be set with the Root Mean Square (RMS) distance between a cloud and a cylinder (optional)
Returns
negative error code or a positive value in case of success

Definition at line 3061 of file DistanceComputationTools.cpp.

References abs(), count, Vector3Tpl< Type >::dot(), cloudViewer::GenericCloud::enableScalarField(), cloudViewer::GenericIndexedCloud::getPoint(), min(), Vector3Tpl< Type >::norm2d(), Vector3Tpl< Type >::normalize(), Vector3Tpl< Type >::normd(), cloudViewer::GenericCloud::setPointScalarValue(), and cloudViewer::GenericCloud::size().

◆ computeCloud2DiscEquation()

int DistanceComputationTools::computeCloud2DiscEquation ( GenericIndexedCloudPersist cloud,
const CCVector3 discCenter,
const PointCoordinateType  discRadius,
const SquareMatrix rotationTransform,
bool  signedDistances = true,
double *  rms = nullptr 
)
static

Computes the distance between each point in a cloud and a disc.

Parameters
clouda 3D point cloud
discCenterdisc 3d center point
discRadiusdisc radius
rotationTransformrotation transformation matrix
signedDistanceswhether to compute the signed or positive (absolute) distance (optional)
[out]rmswill be set with the Root Mean Square (RMS) distance between a cloud and a disc (optional)
Returns
negative error code or a positive value in case of success

Definition at line 3413 of file DistanceComputationTools.cpp.

References abs(), count, dot(), cloudViewer::GenericCloud::enableScalarField(), cloudViewer::GenericIndexedCloud::getPoint(), normal, cloudViewer::GenericCloud::setPointScalarValue(), and cloudViewer::GenericCloud::size().

◆ computeCloud2MeshDistances()

int DistanceComputationTools::computeCloud2MeshDistances ( GenericIndexedCloudPersist pointCloud,
GenericIndexedMesh mesh,
Cloud2MeshDistancesComputationParams params,
GenericProgressCallback progressCb = nullptr,
DgmOctree cloudOctree = nullptr 
)
static

Computes the distance between a point cloud and a mesh.

The algorithm, inspired from METRO by Cignoni et al., is described in Daniel Girardeau-Montaut's PhD manuscript (Chapter 2, section 2.2). It is the general way to compare a point cloud with a triangular mesh.

Parameters
pointCloudthe compared cloud (the distances will be computed on these points)
meshthe reference mesh (the distances will be computed relatively to its triangles)
paramsparameters
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
cloudOctreethe pre-computed octree of the compared cloud (warning: its bounding box should be equal to the union of both point cloud and mesh bbs and it should be cubical - it is automatically computed if 0)
Returns
0 if ok, a negative value otherwise

Definition at line 2498 of file DistanceComputationTools.cpp.

References applySqrtToPointDist(), cloudViewer::DgmOctree::build(), computeCloud2MeshDistanceWithOctree(), cloudViewer::OctreeAndMeshIntersection::distanceTransform, cloudViewer::GenericCloud::enableScalarField(), cloudViewer::utility::floor(), cloudViewer::GenericCloud::forEach(), cloudViewer::GenericCloud::getBoundingBox(), cloudViewer::GenericMesh::getBoundingBox(), cloudViewer::DgmOctree::getOctreeMaxs(), cloudViewer::DgmOctree::getOctreeMins(), cloudViewer::SaitoSquaredDistanceTransform::initGrid(), intersectMeshWithOctree(), cloudViewer::CCMiscTools::MakeMinAndMaxCubical(), max(), cloudViewer::OctreeAndMeshIntersection::maxFillIndexes, cloudViewer::OctreeAndMeshIntersection::mesh, min(), cloudViewer::OctreeAndMeshIntersection::minFillIndexes, cloudViewer::OctreeAndMeshIntersection::octree, octree, params, cloudViewer::OctreeAndMeshIntersection::perCellTriangleList, cloudViewer::SaitoSquaredDistanceTransform::propagateDistance(), result, cloudViewer::ScalarFieldTools::SetScalarValueToNaN(), cloudViewer::GenericCloud::size(), cloudViewer::GenericMesh::size(), Tuple3Tpl< Type >::u, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by ccComparisonDlg::computeApproxDistances(), ccComparisonDlg::computeDistances(), ccRegistrationTools::ICP(), and cloudViewer::ICPRegistrationTools::Register().

◆ computeCloud2MeshDistancesWithOctree()

int DistanceComputationTools::computeCloud2MeshDistancesWithOctree ( const DgmOctree octree,
OctreeAndMeshIntersection intersection,
Cloud2MeshDistancesComputationParams params,
GenericProgressCallback progressCb = nullptr 
)
staticprotected

Computes the distances between a point cloud and a mesh projected into a grid structure This method is used by computeCloud2MeshDistances, after intersectMeshWithOctree has been called.

Parameters
octreethe cloud octree
intersectiona specific structure corresponding the intersection of the mesh with the grid
paramsparameters
progressCbthe client method can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
Returns
negative error code or a positive value in case of success

Definition at line 2252 of file DistanceComputationTools.cpp.

References cloudViewer::DgmOctree::associatedCloud(), ComputeMaxNeighborhoodLength(), ComputeNeighborhood2MeshDistancesWithOctree(), count, cloudViewer::OctreeAndMeshIntersection::distanceTransform, cloudViewer::DgmOctree::getCellCodesAndIndexes(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::DgmOctree::getCellSize(), cloudViewer::DgmOctree::getPointsInCellByCellIndex(), cloudViewer::Grid3D< Type >::getValue(), cloudViewer::OctreeAndMeshIntersection::mesh, cloudViewer::OctreeAndMeshIntersection::minFillIndexes, nProgress, octree, cloudViewer::NormalizedProgress::oneStep(), params, cloudViewer::OctreeAndMeshIntersection::perCellTriangleList, result, cloudViewer::GenericProgressCallback::setInfo(), cloudViewer::GenericProgressCallback::setMethodTitle(), cloudViewer::ReferenceCloud::setPointScalarValue(), cloudViewer::GenericCloud::size(), cloudViewer::ReferenceCloud::size(), cloudViewer::GenericProgressCallback::start(), cloudViewer::GenericProgressCallback::textCanBeEdited(), and cloudViewer::GenericProgressCallback::update().

◆ computeCloud2MeshDistanceWithOctree()

int DistanceComputationTools::computeCloud2MeshDistanceWithOctree ( OctreeAndMeshIntersection theIntersection,
Cloud2MeshDistancesComputationParams params,
GenericProgressCallback progressCb = nullptr 
)
staticprotected

Computes the distances between a point cloud and a mesh projected into a grid structure This method is used by computeCloud2MeshDistances, after intersectMeshWithOctree has been called.

Parameters
theIntersectiona specific structure corresponding the intersection of the mesh with the grid
paramsparameters
progressCbthe client method can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
Returns
-1 if an error occurred (e.g. not enough memory) and 0 otherwise

Definition at line 1429 of file DistanceComputationTools.cpp.

References abs(), cloudViewer::DgmOctree::associatedCloud(), ComparePointsAndTriangles(), cloudViewer::DgmOctree::computeCellCenter(), ComputeMaxNeighborhoodLength(), cloudViewer::DgmOctree::ComputeMinDistanceToCellBorder(), count, dist(), cloudViewer::OctreeAndMeshIntersection::distanceTransform, cloudViewer::DgmOctree::getCellCodesAndIndexes(), cloudViewer::DgmOctree::getCellPos(), cloudViewer::DgmOctree::getCellSize(), cloudViewer::ReferenceCloud::getPointPersistentPtr(), cloudViewer::DgmOctree::getPointsInCellByCellIndex(), cloudViewer::Grid3D< Type >::getValue(), cloudViewer::TriangleList::indexes, max(), cloudViewer::OctreeAndMeshIntersection::maxFillIndexes, cloudViewer::OctreeAndMeshIntersection::mesh, min(), cloudViewer::OctreeAndMeshIntersection::minFillIndexes, nProgress, cloudViewer::OctreeAndMeshIntersection::octree, octree, cloudViewer::NormalizedProgress::oneStep(), params, cloudViewer::OctreeAndMeshIntersection::perCellTriangleList, cloudViewer::GenericProgressCallback::setInfo(), cloudViewer::GenericProgressCallback::setMethodTitle(), cloudViewer::ReferenceCloud::setPointScalarValue(), cloudViewer::GenericCloud::size(), cloudViewer::GenericMesh::size(), cloudViewer::ReferenceCloud::size(), cloudViewer::GenericProgressCallback::start(), cloudViewer::GenericProgressCallback::textCanBeEdited(), Tuple3Tpl< Type >::u, cloudViewer::GenericProgressCallback::update(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by computeCloud2MeshDistances().

◆ ComputeCloud2PlaneDistance()

ScalarType DistanceComputationTools::ComputeCloud2PlaneDistance ( cloudViewer::GenericCloud cloud,
const PointCoordinateType planeEquation,
ERROR_MEASURES  measureType 
)
static

Computes the "distance" (see ERROR_MEASURES) between a point cloud and a plane

Parameters
clouda point cloud
planeEquationplane equation: [a,b,c,d] as 'ax+by+cz=d'
measureTypemeasure type

Definition at line 3651 of file DistanceComputationTools.cpp.

References computeCloud2PlaneDistanceRMS(), ComputeCloud2PlaneMaxDistance(), ComputeCloud2PlaneRobustMax(), MAX_DIST, MAX_DIST_68_PERCENT, MAX_DIST_95_PERCENT, MAX_DIST_99_PERCENT, NAN_VALUE, and RMS.

Referenced by ComputeCellStats(), FastMarchingForFacetExtraction::computeTCoefApprox(), ccKdTreeForFacetExtraction::FuseCells(), and cloudViewer::TrueKdTree::split().

◆ computeCloud2PlaneDistanceRMS()

ScalarType DistanceComputationTools::computeCloud2PlaneDistanceRMS ( GenericCloud cloud,
const PointCoordinateType planeEquation 
)
static

Computes the Root Mean Square (RMS) distance between a cloud and a plane.

Sums the squared distances between each point of the cloud and the plane, then computes the mean value. WARNING: this method uses the cloud global iterator

Parameters
clouda point cloud
planeEquationplane equation: [a,b,c,d] as 'ax+by+cz=d'
Returns
the RMS of distances (or NaN if an error occurred)

Definition at line 3534 of file DistanceComputationTools.cpp.

References abs(), count, cloudViewer::GenericCloud::getNextPoint(), cloudViewer::LessThanEpsilon(), NAN_VALUE, PC_ONE, cloudViewer::GenericCloud::placeIteratorAtBeginning(), cloudViewer::GenericCloud::size(), Tuple3Tpl< Type >::u, Vector3Tpl< PointCoordinateType >::vdot(), and Vector3Tpl< PointCoordinateType >::vnorm2().

Referenced by ComputeCloud2PlaneDistance().

◆ computeCloud2PlaneEquation()

int DistanceComputationTools::computeCloud2PlaneEquation ( GenericIndexedCloudPersist cloud,
const PointCoordinateType planeEquation,
bool  signedDistances = true,
double *  rms = nullptr 
)
static

Computes the distance between each point in a cloud and a plane.

Parameters
clouda 3D point cloud
planeEquationplane equation: [a,b,c,d] as 'ax+by+cz=d' with norm(a,bc)==1
signedDistwhether to compute the signed or positive (absolute) distance (optional)
[out]rmswill be set with the Root Mean Square (RMS) distance between a cloud and a plane (optional)
Returns
negative error code or a positive value in case of success

Definition at line 3187 of file DistanceComputationTools.cpp.

References abs(), count, cloudViewer::GenericCloud::enableScalarField(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::LessThanEpsilon(), PC_ONE, cloudViewer::GenericCloud::setPointScalarValue(), cloudViewer::GenericCloud::size(), Tuple3Tpl< Type >::u, Vector3Tpl< PointCoordinateType >::vdotd(), and Vector3Tpl< PointCoordinateType >::vnorm2().

◆ ComputeCloud2PlaneMaxDistance()

ScalarType DistanceComputationTools::ComputeCloud2PlaneMaxDistance ( GenericCloud cloud,
const PointCoordinateType planeEquation 
)
static

Computes the maximum distance between a point cloud and a plane.

WARNING: this method uses the cloud global iterator

Parameters
clouda point cloud
planeEquationplane equation: [a,b,c,d] as 'ax+by+cz=d'
Returns
the max distance between the point and the plane

Definition at line 3620 of file DistanceComputationTools.cpp.

References abs(), count, cloudViewer::GenericCloud::getNextPoint(), cloudViewer::LessThanEpsilon(), max(), NAN_VALUE, PC_ONE, cloudViewer::GenericCloud::placeIteratorAtBeginning(), cloudViewer::GenericCloud::size(), Tuple3Tpl< Type >::u, Vector3Tpl< PointCoordinateType >::vdot(), and Vector3Tpl< PointCoordinateType >::vnorm2().

Referenced by ComputeCloud2PlaneDistance().

◆ ComputeCloud2PlaneRobustMax()

ScalarType DistanceComputationTools::ComputeCloud2PlaneRobustMax ( GenericCloud cloud,
const PointCoordinateType planeEquation,
float  percent 
)
static

Computes the maximum distance between a point cloud and a plane.

WARNING: this method uses the cloud global iterator

Parameters
clouda point cloud
planeEquationplane equation: [a,b,c,d] as 'ax+by+cz=d'
percentpercentage of lowest values ignored
Returns
the max distance @ 'percent' % between the point and the plane

Definition at line 3566 of file DistanceComputationTools.cpp.

References abs(), cloudViewer::utility::ceil(), count, cloudViewer::GenericCloud::getNextPoint(), cloudViewer::LessThanEpsilon(), NAN_VALUE, PC_ONE, cloudViewer::GenericCloud::placeIteratorAtBeginning(), cloudViewer::GenericCloud::size(), std::swap(), Tuple3Tpl< Type >::u, Vector3Tpl< PointCoordinateType >::vdot(), and Vector3Tpl< PointCoordinateType >::vnorm2().

Referenced by ComputeCloud2PlaneDistance().

◆ computeCloud2PolylineEquation()

int DistanceComputationTools::computeCloud2PolylineEquation ( GenericIndexedCloudPersist cloud,
const Polyline polyline,
double *  rms = nullptr 
)
static

Computes the distance between each point in a cloud and a polyline.

Parameters
clouda 3D point cloud
polylinethe polyline to measure to
[out]rmswill be set with the Root Mean Square (RMS) distance between a cloud and a plane (optional)
Returns
negative error code or a positive value in case of success

Definition at line 3471 of file DistanceComputationTools.cpp.

References computePoint2LineSegmentDistSquared(), count, cloudViewer::GenericCloud::enableScalarField(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::ReferenceCloud::getPoint(), cloudViewer::GreaterThanEpsilon(), min(), NAN_VALUE, cloudViewer::GenericCloud::setPointScalarValue(), cloudViewer::GenericCloud::size(), cloudViewer::ReferenceCloud::size(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

◆ computeCloud2RectangleEquation()

int DistanceComputationTools::computeCloud2RectangleEquation ( GenericIndexedCloudPersist cloud,
PointCoordinateType  widthX,
PointCoordinateType  widthY,
const SquareMatrix rotationTransform,
const CCVector3 center,
bool  signedDist = true,
double *  rms = nullptr 
)
static

◆ computeCloud2SphereEquation()

int DistanceComputationTools::computeCloud2SphereEquation ( GenericIndexedCloudPersist cloud,
const CCVector3 sphereCenter,
const PointCoordinateType  sphereRadius,
bool  signedDistances = true,
double *  rms = nullptr 
)
static

Computes the distance between each point in a cloud and a sphere.

Parameters
clouda 3D point cloud
sphereCentersphere 3d center point
sphereRadiussphere radius
signedDistwhether to compute the signed or positive (absolute) distance (optional)
[out]rmswill be set with the Root Mean Square (RMS) distance between a cloud and a sphere (optional)
Returns
negative error code or a positive value in case of success

Definition at line 3153 of file DistanceComputationTools.cpp.

References abs(), count, cloudViewer::GenericCloud::enableScalarField(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::GenericCloud::setPointScalarValue(), and cloudViewer::GenericCloud::size().

◆ computeGeodesicDistances()

bool DistanceComputationTools::computeGeodesicDistances ( GenericIndexedCloudPersist cloud,
unsigned  seedPointIndex,
unsigned char  octreeLevel,
GenericProgressCallback progressCb = nullptr 
)
static

Computes geodesic distances over a point cloud "surface" (starting from a seed point) This method uses the FastMarching algorithm. Thereofre it needs an octree level as input parameter in order to create the corresponding 3D grid. The greater this level is, the finer the result will be, but more memory will be required as well. Moreover to get an interesting result the cells size should not be too small (the propagation will be stoped more easily on any encountered 'hole').

Parameters
cloudthe point cloud
seedPointIndexthe index of the point from where to start the propagation
octreeLevelthe octree at which to perform the Fast Marching propagation
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
Returns
true if the method succeeds

Definition at line 3680 of file DistanceComputationTools.cpp.

References cloudViewer::DgmOctree::build(), cloudViewer::GenericCloud::enableScalarField(), cloudViewer::GenericCloud::forEach(), cloudViewer::GenericIndexedCloud::getPoint(), cloudViewer::DgmOctree::getTheCellPosWhichIncludesThePoint(), cloudViewer::FastMarchingForPropagation::init(), octree, octreeLevel, cloudViewer::FastMarchingForPropagation::propagate(), result, cloudViewer::FastMarchingForPropagation::setPropagationTimingsAsDistances(), cloudViewer::ScalarFieldTools::SetScalarValueToNaN(), cloudViewer::FastMarching::setSeedCell(), and cloudViewer::GenericCloud::size().

◆ computePoint2LineSegmentDistSquared()

ScalarType DistanceComputationTools::computePoint2LineSegmentDistSquared ( const CCVector3 point,
const CCVector3 start,
const CCVector3 end 
)
static

Computes the square of the distance between a point and a line segment.

Parameters
pointa 3D point
startthe start of line segment
endthe end of line segment
Returns
the distance squared between the point and the line segment

Definition at line 2870 of file DistanceComputationTools.cpp.

References Vector3Tpl< Type >::dot(), and Vector3Tpl< Type >::norm2().

Referenced by computeCloud2PolylineEquation().

◆ computePoint2MeshDistancesWithOctree()

int DistanceComputationTools::computePoint2MeshDistancesWithOctree ( const CCVector3 P,
ScalarType &  distance,
OctreeAndMeshIntersection intersection,
Cloud2MeshDistancesComputationParams params 
)
staticprotected

Computes the distances between a point and a mesh projected into a grid structure

Warning
Distance Transform acceleration is not supported.
No multi-thread support.
No Closest Point Set support.
Parameters
Pthe point
distancethe output distance
intersectiona specific structure corresponding the intersection of the mesh with the grid
paramsparameters
Returns
negative error code or a positive value in case of success

Definition at line 2170 of file DistanceComputationTools.cpp.

References cloudViewer::PointCloudTpl< T >::addPoint(), cloudViewer::ReferenceCloud::addPointIndex(), ComputeMaxNeighborhoodLength(), ComputeNeighborhood2MeshDistancesWithOctree(), cloudViewer::OctreeAndMeshIntersection::distanceTransform, cloudViewer::PointCloudTpl< T >::enableScalarField(), cloudViewer::DgmOctree::getCellSize(), cloudViewer::PointCloudTpl< T >::getPointScalarValue(), cloudViewer::DgmOctree::getTheCellPosWhichIncludesThePoint(), cloudViewer::OctreeAndMeshIntersection::mesh, NAN_VALUE, cloudViewer::OctreeAndMeshIntersection::octree, octree, params, cloudViewer::ReferenceCloud::reserve(), cloudViewer::PointCloudTpl< T >::reserve(), result, and cloudViewer::PointCloudTpl< T >::setPointScalarValue().

◆ computePoint2PlaneDistance()

ScalarType DistanceComputationTools::computePoint2PlaneDistance ( const CCVector3 P,
const PointCoordinateType planeEquation 
)
static

Computes the (signed) distance between a point and a plane.

Parameters
Pa 3D point
planeEquationplane equation: [a,b,c,d] as 'ax+by+cz=d' with norm(a,bc)==1
Returns
the signed distance between the point and the plane

Definition at line 2858 of file DistanceComputationTools.cpp.

References abs(), PC_ONE, Tuple3Tpl< Type >::u, Vector3Tpl< PointCoordinateType >::vdot(), and Vector3Tpl< PointCoordinateType >::vnorm().

Referenced by cloudViewer::CloudSamplingTools::applyNoiseFilterAtLevel(), LSLocalModel::computeDistanceFromModelToPoint(), cloudViewer::Neighbourhood::computeRoughness(), ccCompass::estimateStructureNormals(), qM3C2Tools::GuessBestParams(), and ccMeasurementDevice::measurePointToPlaneDistance().

◆ computePoint2TriangleDistance()

ScalarType DistanceComputationTools::computePoint2TriangleDistance ( const CCVector3 P,
const GenericTriangle theTriangle,
bool  signedDist,
CCVector3 nearestP = nullptr 
)
static

Computes the distance between a point and a triangle.

WARNING: if not signed, the returned distance is SQUARED!

Parameters
Pa 3D point
theTrianglea 3D triangle
signedDistwhether to compute the signed or positive (SQUARED) distance
nearestPoptional: returns the nearest point on the triangle
Returns
the distance between the point and the triangle

Definition at line 2668 of file DistanceComputationTools.cpp.

References cloudViewer::GenericTriangle::_getA(), cloudViewer::GenericTriangle::_getB(), cloudViewer::GenericTriangle::_getC(), a00, a01, a11, Vector3Tpl< Type >::cross(), Vector3Tpl< Type >::dot(), Vector3Tpl< PointCoordinateType >::fromArray(), Tuple3Tpl< Type >::u, Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by ComparePointsAndTriangles(), and DelaunayLocalModel::computeDistanceFromModelToPoint().

◆ ComputeSquareDistToSegment()

PointCoordinateType DistanceComputationTools::ComputeSquareDistToSegment ( const CCVector2 P,
const CCVector2 A,
const CCVector2 B,
bool  onlyOrthogonal = false 
)
static

Returns the (squared) distance from a point to a segment.

Parameters
P3D point
Afirst point of the segment
Bfirst point of the segment
onlyOrthogonalcomputes distance only if P lies 'in front' of AB (returns -1.0 otherwise)
Returns
squared distance (or potentially -1.0 if onlyOrthogonal is true)

Definition at line 3897 of file DistanceComputationTools.cpp.

References Vector2Tpl< Type >::dot(), dot(), Vector2Tpl< Type >::norm2(), and PC_ONE.

◆ diff()

int DistanceComputationTools::diff ( GenericIndexedCloudPersist comparedCloud,
GenericIndexedCloudPersist referenceCloud,
GenericProgressCallback progressCb = nullptr 
)
static

Computes the differences between two scalar fields associated to equivalent point clouds The compared cloud should be smaller or equal to the reference cloud. Its points should be at the same position in space as points in the other cloud. The algorithm simply computes the difference between the scalar values associated to each couple of equivalent points.

Warning
The result is stored in the active scalar field (input) of the comparedCloud.
Moreover, the output scalar field should be different than the input scalar field!
Be sure to activate an OUTPUT scalar field on both clouds
Parameters
comparedCloudthe compared cloud
referenceCloudthe reference cloud
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)

Definition at line 3720 of file DistanceComputationTools.cpp.

References computeCloud2CloudDistances(), cloudViewer::GenericCloud::getPointScalarValue(), cloudViewer::ReferenceCloud::getPointScalarValue(), cloudViewer::DgmOctree::MAX_OCTREE_LEVEL, NAN_VALUE, params, result, cloudViewer::GenericCloud::setPointScalarValue(), cloudViewer::GenericCloud::size(), and cloudViewer::ScalarField::ValidValue().

◆ intersectMeshWithOctree()

int DistanceComputationTools::intersectMeshWithOctree ( OctreeAndMeshIntersection theIntersection,
unsigned char  octreeLevel,
GenericProgressCallback progressCb = nullptr 
)
staticprotected

Intersects a mesh with a grid structure.

This method is used by computeCloud2MeshDistances.

Parameters
theIntersectiona specific structure to store the result of the intersection
octreeLevelthe octree subdivision level corresponding to the grid
progressCbthe client method can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)

Definition at line 741 of file DistanceComputationTools.cpp.

References cloudViewer::GenericTriangle::_getA(), cloudViewer::GenericTriangle::_getB(), cloudViewer::GenericTriangle::_getC(), cloudViewer::GenericMesh::_getNextTriangle(), cloudViewer::utility::ceil(), CellToTest::cellSize, cloudViewer::DgmOctree::computeCellCenter(), Vector3Tpl< Type >::cross(), cloudViewer::OctreeAndMeshIntersection::distanceTransform, Vector3Tpl< Type >::dot(), cloudViewer::DgmOctree::getCellSize(), cloudViewer::DgmOctree::getOctreeMins(), cloudViewer::DgmOctree::getTheCellPosWhichIncludesThePoint(), cloudViewer::GreaterThanEpsilon(), CellToTest::level, max(), cloudViewer::OctreeAndMeshIntersection::maxFillIndexes, cloudViewer::OctreeAndMeshIntersection::mesh, min(), cloudViewer::OctreeAndMeshIntersection::minFillIndexes, Vector3Tpl< Type >::norm2(), nProgress, cloudViewer::OctreeAndMeshIntersection::octree, octree, octreeLevel, cloudViewer::OctreeAndMeshIntersection::perCellTriangleList, cloudViewer::GenericMesh::placeIteratorAtBeginning(), CellToTest::pos, cloudViewer::TriangleList::push(), result, cloudViewer::GenericProgressCallback::setInfo(), cloudViewer::GenericProgressCallback::setMethodTitle(), cloudViewer::Grid3D< Type >::setValue(), cloudViewer::GenericMesh::size(), cloudViewer::GenericProgressCallback::start(), cloudViewer::GenericProgressCallback::textCanBeEdited(), cloudViewer::CCMiscTools::TriBoxOverlap(), Tuple3Tpl< Type >::u, cloudViewer::GenericProgressCallback::update(), Tuple3Tpl< Type >::x, Tuple3Tpl< Type >::y, and Tuple3Tpl< Type >::z.

Referenced by computeCloud2MeshDistances().

◆ MultiThreadSupport()

bool DistanceComputationTools::MultiThreadSupport ( )
static

Returns whether multi-threading (parallel) computation is supported or not

Definition at line 104 of file DistanceComputationTools.cpp.

◆ synchronizeOctrees()

DistanceComputationTools::SOReturnCode DistanceComputationTools::synchronizeOctrees ( GenericIndexedCloudPersist comparedCloud,
GenericIndexedCloudPersist referenceCloud,
DgmOctree *&  comparedOctree,
DgmOctree *&  referenceOctree,
PointCoordinateType  maxSearchDist = 0,
GenericProgressCallback progressCb = nullptr 
)
static

Synchronizes (and re-build if necessary) two octrees.

Initializes the octrees before computing the distance between two clouds. Check if both octree have the same sizes and limits (in 3D) and rebuild them if necessary.

Parameters
comparedCloudthe cloud corresponding to the first octree
referenceCloudthe cloud corresponding to the second octree
comparedOctreethe first octree
referenceOctreethe second octree
maxSearchDistmax search distance (or any negative value if no max distance is defined)
progressCbthe client method can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)
Returns
return code

Definition at line 242 of file DistanceComputationTools.cpp.

References cloudViewer::DgmOctree::build(), cloudViewer::DgmOctree::clear(), DISJOINT, EMPTY_CLOUD, cloudViewer::GenericCloud::getBoundingBox(), cloudViewer::DgmOctree::getNumberOfProjectedPoints(), cloudViewer::DgmOctree::getOctreeMaxs(), cloudViewer::DgmOctree::getOctreeMins(), cloudViewer::CCMiscTools::MakeMinAndMaxCubical(), max(), min(), OUT_OF_MEMORY, cloudViewer::GenericCloud::size(), SYNCHRONIZED, and Tuple3Tpl< Type >::u.

Referenced by computeApproxCloud2CloudDistance(), and computeCloud2CloudDistances().


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