| 418 | } |
| 419 | |
| 420 | bool 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 | |
| 457 | float MultiwayICP::getMeanSqDistToPoint( std::optional<double> value ) const |
| 458 | { |
nothing calls this directly
no test coverage detected