MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / resamplePoints

Method resamplePoints

source/MRMesh/MRMultiwayICP.cpp:420–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420bool MultiwayICP::resamplePoints( const MultiwayICPSamplingParameters& samplingParams )
421{
422 MR_TIMER;
423
424 maxGroupSize_ = samplingParams.maxGroupSize;
425 setupLayers_( samplingParams.cascadeMode );
426
427 samplingSize_ = samplingParams.samplingVoxelSize;
428 bool cascadeMode = pairsGridPerLayer_.size() > 1;
429
430 Vector<VertBitSet, ObjId> samplesPerObj( objs_.size() );
431
432 float maxProgress = cascadeMode ? 0.2f : 0.5f;
433 auto keepGoing = ParallelFor( objs_, [&] ( ObjId ind )
434 {
435 const auto& obj = objs_[ind];
436 samplesPerObj[ind] = *obj.obj.pointsGridSampling( samplingSize_ );
437 }, subprogress( samplingParams.cb, 0.0f, maxProgress ) );
438
439 if ( !keepGoing )
440 return false;
441
442 float maxProgress2 = cascadeMode ? 0.4f : 1.0f;
443 reservePairsLayer0_( std::move( samplesPerObj ), subprogress( samplingParams.cb, maxProgress, maxProgress2 ) );
444
445 if ( !cascadeMode )
446 return true;
447
448 maxProgress = maxProgress2;
449 maxProgress2 = 0.7f;
450 auto samplesPerUnit = resampleUpperLayers_( subprogress( samplingParams.cb, maxProgress, maxProgress2 ) );
451 if ( !samplesPerUnit )
452 return false;
453 // only do something if cascade mode is required, really should be called on each iteration
454 return reserveUpperLayerPairs_( std::move( *samplesPerUnit ), subprogress( samplingParams.cb, maxProgress2, 1.0f ) );
455}
456
457float MultiwayICP::getMeanSqDistToPoint( std::optional<double> value ) const
458{

Callers

nothing calls this directly

Calls 4

ParallelForFunction · 0.85
subprogressFunction · 0.85
pointsGridSamplingMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected