26 virtual size_t size()
const override {
return vec.size(); }
27 std::vector<ICPGroupPair>
vec;
34 float cosThreshold,
float distThresholdSq,
bool mutualClosest );
148 PairsPerLayer pairsGridPerLayer_;
153 std::function<void(
int )> perIterationCb_;
155 std::unique_ptr<IICPTreeIndexer> cascadeIndexer_;
158 void setupLayers_( MultiwayICPSamplingParameters::CascadeMode mode );
162 bool reservePairsLayer0_( Vector<VertBitSet, ObjId>&& samples,
const ProgressCallback& cb );
164 using LayerSamples = Vector<Vector<MultiObjsSamples, ICPElementId>, ICPLayer>;
165 std::optional<LayerSamples> resampleUpperLayers_(
const ProgressCallback& cb );
166 bool reserveUpperLayerPairs_( LayerSamples&& samples,
const ProgressCallback& cb );
169 bool updateLayerPairs_( ICPLayer l,
const ProgressCallback& cb = {} );
171 void deactivateFarDistPairs_( ICPLayer l );
173 float samplingSize_{ 0.0f };
183 int maxGroupSize_{ 64 };
185 bool doIteration_(
bool p2pl );
188 bool multiwayIter_(
bool p2pl =
true );
189 bool cascadeIter_(
bool p2pl =
true );
191 void calcGen_(
bool p2pl,
const ProgressCallback& cb );
192 void calcP2Pt_(
const ProgressCallback& cb );
193 void calcP2Pl_(
const ProgressCallback& cb );
194 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:41
stores index of some element, it is made as template class to avoid mixing faces, edges and vertices
Definition MRId.h:19
std::vector<T>-like container that requires specific indexing type,
Definition MRVector.h:23
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:753
Vector< AffineXf3f, ObjId > calculateTransformationsFixFirst(const ProgressCallback &cb={})
float getMeanSqDistToPlane(std::optional< double > value={}) const
virtual size_t getNumElements(ICPLayer l) const =0
virtual ICPElementBitSet getElementNodes(ICPLayer l, ICPElementId eId) const =0
CascadeMode
Definition MRMultiwayICP.h:75
virtual const ICPPairData & operator[](size_t idx) const override
Definition MRMultiwayICP.h:24
const ICPProperties & getParams() const
Definition MRMultiwayICP.h:112
virtual size_t size() const override
Definition MRMultiwayICP.h:26
virtual bool fromSameNode(ICPLayer l, ICPElementId eI, ICPElementId eJ) const =0
returns true if eI and eJ are from same node
MultiwayICP(const ICPObjects &objects, const MultiwayICPSamplingParameters &samplingParams)
size_t getNumSamples() const
computes the number of samples able to form pairs
std::function< void(const Vector3f &p, MeshOrPoints::ProjectionResult &res, ObjId &resId)> ICPGroupProjector
Definition MRMultiwayICP.h:30
virtual size_t getNumLayers() const =0
Vector< ICPPairsGrid, ICPLayer > PairsPerLayer
Definition MRMultiwayICP.h:139
const PairsPerLayer & getPairsPerLayer() const
returns all pairs of all layers
Definition MRMultiwayICP.h:141
Vector< Vector< ICPGroupPairs, ICPElementId >, ICPElementId > ICPPairsGrid
Definition MRMultiwayICP.h:36
size_t getNumActivePairs() const
computes the number of active point pairs
ObjVertId tgtClosestId
Definition MRMultiwayICP.h:20
void devEnableIndependentEquationsMode(bool on)
Definition MRMultiwayICP.h:134
ProgressCallback cb
callback for progress reports
Definition MRMultiwayICP.h:81
ObjVertId srcId
Definition MRMultiwayICP.h:19
virtual ~IICPTreeIndexer()=default
std::vector< ICPGroupPair > vec
Definition MRMultiwayICP.h:27
std::string getStatusInfo() const
returns status info string
bool resamplePoints(const MultiwayICPSamplingParameters &samplingParams)
select pairs with origin samples on all objects
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)
int maxGroupSize
Definition MRMultiwayICP.h:72
Vector< AffineXf3f, ObjId > calculateTransformations(const ProgressCallback &cb={})
TypedBitSet< Id< T > > TaggedBitSet
Definition MRMeshFwd.h:169
Id< ICPElemtTag > ICPElementId
Definition MRMultiwayICP.h:15
float samplingVoxelSize
sampling size of each object, 0 has special meaning "take all valid points"
Definition MRMultiwayICP.h:66
ICPExitType
types of exit conditions in calculation
Definition MRICPEnums.h:32
Vector< MeshOrPointsXf, ObjId > ICPObjects
Definition MRMultiwayICP.h:11
bool updateAllPointPairs(const ProgressCallback &cb={})
float getMeanSqDistToPoint(std::optional< double > value={}) const
IPointPairs()=default
required to declare explicitly to avoid warnings
int ICPLayer
Definition MRMultiwayICP.h:13
enum MR::MultiwayICPSamplingParameters::CascadeMode AABBTreeBased
const IICPTreeIndexer * getCascadeIndexer() const
Definition MRMultiwayICP.h:145
void setPerIterationCallback(std::function< void(int inter)> callback)
sets callback that will be called for each iteration
Definition MRMultiwayICP.h:129
bool devIndependentEquationsModeEnabled() const
Definition MRMultiwayICP.h:133
virtual ObjBitSet getElementLeaves(ICPLayer l, ICPElementId eId) const =0
returns bitset of leaves of given node
TaggedBitSet< ICPElemtTag > ICPElementBitSet
Definition MRMultiwayICP.h:16
virtual ICPPairData & operator[](size_t idx) override
Definition MRMultiwayICP.h:25
void setParams(const ICPProperties &prop)
tune algorithm params before run calculateTransformations()
Definition MRMultiwayICP.h:111
@ AABBTreeBased
separates objects on groups based on their index in ICPObjects (good if all objects about the size of...
Definition MRMultiwayICP.h:77
@ Sequential
Definition MRMultiwayICP.h:76
@ NotStarted
Definition MRICPEnums.h:33
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRMultiwayICP.h:18
Definition MRMultiwayICP.h:23
parameters of ICP algorithm
Definition MRICP.h:125
Definition MRMeshOrPoints.h:72
Parameters that are used for sampling of the MultiwayICP objects.
Definition MRMultiwayICP.h:64
Definition MRGridSampling.h:43