Skip to content

Commit

Permalink
New 'robust' option for the C2M algorithm to compute determine the si…
Browse files Browse the repository at this point in the history
…gn of the Cloud/Mesh distances in a more robust way (but with added computation time)
  • Loading branch information
dgirardeau committed Mar 10, 2024
1 parent 10bb6ff commit a8ce427
Show file tree
Hide file tree
Showing 4 changed files with 210 additions and 62 deletions.
22 changes: 16 additions & 6 deletions include/DistanceComputationTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ namespace CCCoreLib
**/
PointCloud* CPSet;

//! Whether to compute distances in a robust way (trying to detect edge cases)
/** Computation will be slightly slower, and a little bit more memory will be required
**/
bool robust;

//! Default constructor
Cloud2MeshDistancesComputationParams()
: octreeLevel(0)
Expand All @@ -190,6 +195,7 @@ namespace CCCoreLib
, multiThread(true)
, maxThreadCount(0)
, CPSet(nullptr)
, robust(true)
{}
};

Expand Down Expand Up @@ -271,17 +277,21 @@ namespace CCCoreLib
//! Computes the distance between a point and a triangle
/** \warning if not signed, the returned distance is SQUARED!
\param P a 3D point
\param theTriangle a 3D triangle
\param signedDistances whether to compute the signed or positive (SQUARED) distance
\param nearestP optional: returns the nearest point on the triangle
\param[in] P a 3D point
\param[in] theTriangle a 3D triangle
\param[in] signedDistance whether to compute the signed or positive (SQUARED) distance
\param[out] nearestP optional: returns the nearest point on the triangle
\param[out] nearestPInside optional: whether the nearest point (= projection) falls inside the triangle
\param[out] dotProd optional: if signedDistance is true, the dot product between the point and the triangle normal
\return the distance between the point and the triangle
**/
static ScalarType computePoint2TriangleDistance(const CCVector3* P,
const GenericTriangle* theTriangle,
bool signedDistances,
CCVector3* nearestP = nullptr);
bool signedDistance,
CCVector3* nearestP = nullptr,
bool* nearestPInside = nullptr,
double* dotProd = nullptr);

//! Computes the (signed) distance between a point and a plane
/** \param P a 3D point
Expand Down
4 changes: 4 additions & 0 deletions include/RegistrationTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ namespace CCCoreLib
, transformationFilters(SKIP_NONE)
, maxThreadCount(0)
, useC2MSignedDistances(false)
, robustC2MSignedDistances(true)
, normalsMatching(NO_NORMAL)
{}

Expand Down Expand Up @@ -212,6 +213,9 @@ namespace CCCoreLib
**/
bool useC2MSignedDistances;

//! Whether to compute robust signed C2M distances.
bool robustC2MSignedDistances;

//! Normals matching method
NORMALS_MATCHING normalsMatching;
};
Expand Down
Loading

0 comments on commit a8ce427

Please sign in to comment.