| 623 | } |
| 624 | |
| 625 | std::optional<MultiwayICP::LayerSamples> MultiwayICP::resampleUpperLayers_( const ProgressCallback& cb ) |
| 626 | { |
| 627 | MR_TIMER; |
| 628 | if ( pairsGridPerLayer_.size() < 2 ) |
| 629 | return {}; |
| 630 | |
| 631 | auto numLayers = cascadeIndexer_->getNumLayers(); |
| 632 | LayerSamples samples( numLayers ); |
| 633 | for ( ICPLayer l = 1; l < numLayers; ++l ) |
| 634 | { |
| 635 | auto& layerSamples = samples[l]; |
| 636 | layerSamples.resize( cascadeIndexer_->getNumElements( l ) ); |
| 637 | bool keepGoing = ParallelFor( layerSamples, [&] ( ICPElementId gId ) |
| 638 | { |
| 639 | const auto& layerLeaves = cascadeIndexer_->getElementLeaves( l, gId ); |
| 640 | Vector<ModelPointsData, ObjId> groupData; |
| 641 | groupData.reserve( layerLeaves.count() ); |
| 642 | for ( ObjId oId : layerLeaves ) |
| 643 | { |
| 644 | const auto& obj = objs_[oId]; |
| 645 | groupData.emplace_back( ModelPointsData{ .points = &obj.obj.points(), .validPoints = &obj.obj.validPoints(),.xf = &obj.xf,.fakeObjId = oId } ); |
| 646 | } |
| 647 | layerSamples[gId] = *multiModelGridSampling( groupData, samplingSize_ ); |
| 648 | }, subprogress( cb, float( l - 1 ) / float( numLayers - 1 ), float( l ) / float( numLayers - 1 ) ) ); |
| 649 | if ( !keepGoing ) |
| 650 | return {}; |
| 651 | } |
| 652 | return samples; |
| 653 | } |
| 654 | |
| 655 | bool MultiwayICP::reserveUpperLayerPairs_( LayerSamples&& samples, const ProgressCallback& cb ) |
| 656 | { |
nothing calls this directly
no test coverage detected