@@ -311,14 +311,27 @@ namespace CCCoreLib
311311 static ScalarType computePoint2LineSegmentDistSquared (const CCVector3* point, const CCVector3* start, const CCVector3* end);
312312
313313 // ! Computes the distance between each point in a cloud and a cone
314- /* * \param[in] cloud a 3D point cloud
315- \param[in] coneP1 center point associated with the larger radii
316- \param[in] coneP2 center point associated with the smaller radii
317- \param[in] coneR1 cone radius at coneP1 (larger)
318- \param[in] coneR2 cone radius at coneP2 (smaller)
319- \param[in] signedDistances whether to compute the signed or positive (absolute) distance (optional)
320- \param[in] solutionType if true the scalar field will be set to which solution was selected 1-4 (optional)
321- \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a cylinder (optional)
314+ /* * This algorithm is a modification of the distance computation between a point and a cylinder from
315+ Barbier & Galin's Fast Distance Computation Between a Point and Cylinders, Cones, Line Swept Spheres and Cone-Spheres.
316+ The modifications from the paper are to compute the closest distance when the point is interior to the capped cylinder.
317+ http://liris.cnrs.fr/Documents/Liris-1297.pdf
318+
319+ If outputSolutionType is true (mostly for debug purpose), the possible values of the scalar field will be:
320+ - 1 = below the bottom point within larger disk radius
321+ - 2 = below the bottom point not within larger disk radius
322+ - 3 = above the bottom point, within smaller disk radius, outside cone
323+ - 4 = above the bottom point, within smaller disk radius, inside cone
324+ - 7 = above the bottom point, outside smaller disk radius, point projects onto the large cap
325+ - 8 = above the bottom point, outside smaller disk radius, point projects onto the small cap
326+ - 9 = above the bottom point, outside smaller disk radius, onto the side of the cone (dist > 0) or inside (dist < 0)
327+ \param[in] cloud a 3D point cloud
328+ \param[in] coneP1 center point associated with the larger radii
329+ \param[in] coneP2 center point associated with the smaller radii
330+ \param[in] coneR1 cone radius at coneP1 (larger)
331+ \param[in] coneR2 cone radius at coneP2 (smaller)
332+ \param[in] signedDistances whether to compute signed or positive distances
333+ \param[in] outputSolutionType if true the scalar field will be set to which solution was selected (from 1 to 4 or from 7 to 9 - see above)
334+ \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a cone (optional)
322335
323336 \return negative error code or a positive value in case of success
324337 **/
@@ -328,17 +341,28 @@ namespace CCCoreLib
328341 const PointCoordinateType coneR1,
329342 const PointCoordinateType coneR2,
330343 bool signedDistances = true ,
331- bool solutionType = false ,
344+ bool outputSolutionType = false ,
332345 double * rms = nullptr );
333346
334347 // ! Computes the distance between each point in a cloud and a cylinder
335- /* * \param[in] cloud a 3D point cloud
336- \param[in] cylinderP1 center bottom point
337- \param[in] cylinderP2 center top point
338- \param[in] cylinderRadius cylinder radius
339- \param[in] signedDistances whether to compute the signed or positive (absolute) distance (optional)
340- \param[in] solutionType if true the scalar field will be set to which solution was selected 1-4 (optional)
341- \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a cylinder (optional)
348+ /* * This algorithm is a modification of the distance computation between a point and a cone from
349+ Barbier & Galin's Fast Distance Computation Between a Point and Cylinders, Cones, Line Swept Spheres and Cone-Spheres.
350+ The modifications from the paper are to compute the closest distance when the point is interior to the cone.
351+ http://liris.cnrs.fr/Documents/Liris-1297.pdf
352+
353+ If outputSolutionType is true (mostly for debug purpose), the possible values of the scalar field will be:
354+ - 1 = exterior to the cylinder and within the bounds of the axis
355+ - 2 = interior to the cylinder and either closer to an end-cap or the cylinder wall
356+ - 3 = beyond the bounds of the cylinder's axis and radius
357+ - 4 = beyond the bounds of the cylinder's axis but within the bounds of it's radius
358+
359+ \param[in] cloud a 3D point cloud
360+ \param[in] cylinderP1 center bottom point
361+ \param[in] cylinderP2 center top point
362+ \param[in] cylinderRadius cylinder radius
363+ \param[in] signedDistances whether to compute signed or positive distances
364+ \param[in] outputSolutionType if true the scalar field will be set to which solution was selected (from 1 to 4 - see above)
365+ \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a cylinder (optional)
342366
343367 \return negative error code or a positive value in case of success
344368 **/
@@ -347,14 +371,14 @@ namespace CCCoreLib
347371 const CCVector3& cylinderP2,
348372 const PointCoordinateType cylinderRadius,
349373 bool signedDistances = true ,
350- bool solutionType = false ,
374+ bool outputSolutionType = false ,
351375 double * rms = nullptr );
352376
353377 // ! Computes the distance between each point in a cloud and a sphere
354378 /* * \param[in] cloud a 3D point cloud
355379 \param[in] sphereCenter sphere 3d center point
356380 \param[in] sphereRadius sphere radius
357- \param[in] signedDistances whether to compute the signed or positive (absolute) distance (optional)
381+ \param[in] signedDistances whether to compute signed or positive distances
358382 \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a sphere (optional)
359383
360384 \return negative error code or a positive value in case of success
@@ -365,13 +389,30 @@ namespace CCCoreLib
365389 bool signedDistances = true ,
366390 double * rms = nullptr );
367391
392+ // ! Computes the distance between each point in a cloud and a disc
393+ /* * \param[in] cloud a 3D point cloud
394+ \param[in] discCenter disc 3D center point
395+ \param[in] discRadius disc radius
396+ \param[in] rotationTransform (plane) disc position in space
397+ \param[in] signedDistances whether to compute signed or absolute distances
398+ \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a disc (optional)
399+
400+ \return negative error code or a positive value in case of success
401+ **/
402+ static int computeCloud2DiscEquation (GenericIndexedCloudPersist* cloud,
403+ const CCVector3& discCenter,
404+ const PointCoordinateType discRadius,
405+ const SquareMatrix& rotationTransform,
406+ bool signedDistances = true ,
407+ double * rms = nullptr );
408+
368409 // ! Computes the distance between each point in a cloud and a plane
369410 /* * \param[in] cloud a 3D point cloud
370- \param[in] planeEquation plane equation: [a,b,c,d] as 'ax+by+cz=d' with norm(a,bc)==1
371- \param[in] signedDistances whether to compute the signed or positive ( absolute) distance (optional)
372- \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a plane (optional)
411+ \param[in] planeEquation plane equation: [a,b,c,d] as 'ax+by+cz=d' with norm(a,bc)==1
412+ \param[in] signedDistances whether to compute signed or absolute distances
413+ \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a plane (optional)
373414
374- \return negative error code or a positive value in case of success
415+ \return negative error code or a positive value in case of success
375416 **/
376417 static int computeCloud2PlaneEquation ( GenericIndexedCloudPersist* cloud,
377418 const PointCoordinateType* planeEquation,
@@ -384,7 +425,7 @@ namespace CCCoreLib
384425 \param[in] widthY rectangle height
385426 \param[in] rotationTransform (plane) rectangle position in space
386427 \param[in] center (plane) rectangle center point
387- \param[in] signedDistances whether to compute the signed or positive ( absolute) distance (optional)
428+ \param[in] signedDistances whether to compute signed or absolute distances
388429 \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a rectangle (optional)
389430
390431 \return negative error code or a positive value in case of success
@@ -402,7 +443,7 @@ namespace CCCoreLib
402443 \param[in] boxDimensions box 3D dimensions
403444 \param[in] rotationTransform box position in space
404445 \param[in] boxCenter box center point
405- \param[in] signedDistances whether to compute the signed or positive (absolute) distance (optional)
446+ \param[in] signedDistances whether to compute signed or positive distances
406447 \param[out] rms will be set with the Root Mean Square (RMS) distance between a cloud and a box (optional)
407448
408449 \return negative error code or a positive value in case of success
0 commit comments