MCPcopy Create free account
hub / github.com/PDAL/PDAL / computeHausdorff

Function computeHausdorff

pdal/PDALUtils.cpp:399–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399double computeHausdorff(PointViewPtr srcView, PointViewPtr candView)
400{
401 using namespace Dimension;
402
403 KD3Index &srcIndex = srcView->build3dIndex();
404 KD3Index &candIndex = candView->build3dIndex();
405
406 double maxDistSrcToCand = std::numeric_limits<double>::lowest();
407 double maxDistCandToSrc = std::numeric_limits<double>::lowest();
408
409 for (PointRef p : *srcView)
410 {
411 PointIdList indices(1);
412 std::vector<double> sqr_dists(1);
413 candIndex.knnSearch(p, 1, &indices, &sqr_dists);
414
415 if (sqr_dists[0] > maxDistSrcToCand)
416 maxDistSrcToCand = sqr_dists[0];
417 }
418
419 for (PointRef q : *candView)
420 {
421 PointIdList indices(1);
422 std::vector<double> sqr_dists(1);
423 srcIndex.knnSearch(q, 1, &indices, &sqr_dists);
424
425 if (sqr_dists[0] > maxDistCandToSrc)
426 maxDistCandToSrc = sqr_dists[0];
427 }
428
429 maxDistSrcToCand = std::sqrt(maxDistSrcToCand);
430 maxDistCandToSrc = std::sqrt(maxDistCandToSrc);
431
432 return (std::max)(maxDistSrcToCand, maxDistCandToSrc);
433}
434
435std::pair<double, double> computeHausdorffPair(PointViewPtr viewA,
436 PointViewPtr viewB)

Callers

nothing calls this directly

Calls 1

knnSearchMethod · 0.45

Tested by

no test coverage detected