23 virtual size_t size()
const override {
return vec.size(); }
24 std::vector<ICPGroupPair>
vec;
31 float cosThreshold,
float distThresholdSq,
bool mutualClosest );
145 PairsPerLayer pairsGridPerLayer_;
148 ICPExitType resultType_{ ICPExitType::NotStarted };
150 std::function<void(
int )> perIterationCb_;
152 std::unique_ptr<IICPTreeIndexer> cascadeIndexer_;
155 void setupLayers_( MultiwayICPSamplingParameters::CascadeMode mode );
159 bool reservePairsLayer0_( Vector<VertBitSet, ObjId>&& samples,
const ProgressCallback& cb );
161 using LayerSamples = Vector<Vector<MultiObjsSamples, ICPElementId>, ICPLayer>;
162 std::optional<LayerSamples> resampleUpperLayers_(
const ProgressCallback& cb );
163 bool reserveUpperLayerPairs_( LayerSamples&& samples,
const ProgressCallback& cb );
166 bool updateLayerPairs_( ICPLayer l,
const ProgressCallback& cb = {} );
168 void deactivateFarDistPairs_( ICPLayer l );
170 float samplingSize_{ 0.0f };
180 int maxGroupSize_{ 64 };
182 bool doIteration_(
bool p2pl );
185 bool multiwayIter_(
bool p2pl =
true );
186 bool cascadeIter_(
bool p2pl =
true );
188 void calcGen_(
bool p2pl,
const ProgressCallback& cb );
189 void calcP2Pt_(
const ProgressCallback& cb );
190 void calcP2Pl_(
const ProgressCallback& cb );
191 void calcCombined_(
const ProgressCallback& cb );
#define MRMESH_API
Definition MRMeshFwd.h:80
#define MRMESH_CLASS
Definition MRMeshFwd.h:87
structure to find leafs and groups of each in cascade mode
Definition MRMultiwayICP.h:38
virtual size_t getNumElements(ICPLayer l) const =0
virtual ICPElementBitSet getElementNodes(ICPLayer l, ICPElementId eId) const =0
virtual bool fromSameNode(ICPLayer l, ICPElementId eI, ICPElementId eJ) const =0
returns true if eI and eJ are from same node
virtual size_t getNumLayers() const =0
virtual ~IICPTreeIndexer()=default
virtual ObjBitSet getElementLeaves(ICPLayer l, ICPElementId eId) const =0
returns bitset of leaves of given node
Definition MRMultiwayICP.h:86
MRMESH_API std::string getStatusInfo() const
returns status info string
MRMESH_API Vector< AffineXf3f, ObjId > calculateTransformationsFixFirst(const ProgressCallback &cb={})
const ICPProperties & getParams() const
Definition MRMultiwayICP.h:109
MRMESH_API bool updateAllPointPairs(const ProgressCallback &cb={})
MRMESH_API size_t getNumActivePairs() const
computes the number of active point pairs
const PairsPerLayer & getPairsPerLayer() const
returns all pairs of all layers
Definition MRMultiwayICP.h:138
void devEnableIndependentEquationsMode(bool on)
Definition MRMultiwayICP.h:131
MRMESH_API Vector< AffineXf3f, ObjId > calculateTransformations(const ProgressCallback &cb={})
MRMESH_API MultiwayICP(const ICPObjects &objects, const MultiwayICPSamplingParameters &samplingParams)
MRMESH_API float getMeanSqDistToPoint(std::optional< double > value={}) const
MRMESH_API size_t getNumSamples() const
computes the number of samples able to form pairs
MRMESH_API float getMeanSqDistToPlane(std::optional< double > value={}) const
const IICPTreeIndexer * getCascadeIndexer() const
Definition MRMultiwayICP.h:142
void setPerIterationCallback(std::function< void(int inter)> callback)
sets callback that will be called for each iteration
Definition MRMultiwayICP.h:126
bool devIndependentEquationsModeEnabled() const
Definition MRMultiwayICP.h:130
void setParams(const ICPProperties &prop)
tune algorithm params before run calculateTransformations()
Definition MRMultiwayICP.h:108
MRMESH_API bool resamplePoints(const MultiwayICPSamplingParameters &samplingParams)
select pairs with origin samples on all objects
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:742
Definition MRCameraOrientationPlugin.h:8
std::function< void(const Vector3f &p, MeshOrPoints::ProjectionResult &res, ObjId &resId)> ICPGroupProjector
Definition MRMultiwayICP.h:27
MRMESH_API void updateGroupPairs(ICPGroupPairs &pairs, const ICPObjects &objs, ICPGroupProjector srcProjector, ICPGroupProjector tgtProjector, float cosThreshold, float distThresholdSq, bool mutualClosest)
in each pair updates the target data and performs basic filtering (activation)
ICPExitType
Definition MRICPEnums.h:29
int ICPLayer
Definition MRMultiwayICP.h:10
TaggedBitSet< ICPElemtTag > ICPElementBitSet
Definition MRMultiwayICP.h:13
Definition MRMultiwayICP.h:15
ObjVertId tgtClosestId
Definition MRMultiwayICP.h:17
ObjVertId srcId
Definition MRMultiwayICP.h:16
Definition MRMultiwayICP.h:20
virtual const ICPPairData & operator[](size_t idx) const override
Definition MRMultiwayICP.h:21
virtual size_t size() const override
Definition MRMultiwayICP.h:23
std::vector< ICPGroupPair > vec
Definition MRMultiwayICP.h:24
virtual ICPPairData & operator[](size_t idx) override
Definition MRMultiwayICP.h:22
parameters of ICP algorithm
Definition MRICP.h:122
Simple interface for pairs holder.
Definition MRICP.h:60
Definition MRMeshOrPoints.h:69
Parameters that are used for sampling of the MultiwayICP objects.
Definition MRMultiwayICP.h:61
CascadeMode
Definition MRMultiwayICP.h:72
@ AABBTreeBased
separates objects on groups based on their index in ICPObjects (good if all objects about the size of...
ProgressCallback cb
callback for progress reports
Definition MRMultiwayICP.h:78
int maxGroupSize
Definition MRMultiwayICP.h:69
float samplingVoxelSize
sampling size of each object, 0 has special meaning "take all valid points"
Definition MRMultiwayICP.h:63
enum MR::MultiwayICPSamplingParameters::CascadeMode AABBTreeBased
Definition MRGridSampling.h:40