MeshLib
 
Loading...
Searching...
No Matches
MRDotNet/MRICP.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include "MRMesh/MRICPEnums.h"
4#include "MRVector3.h"
5#pragma managed( push, off )
6#include <MRMesh/MRICP.h>
7#pragma managed( pop )
8
10
12public ref struct PointPair
13{
16
19
22
25
27 float distSq = 0.f;
28
30 float weight = 1.f;
31
34
38
40 float normalsAngleCos = 1.f;
41
43 bool tgtOnBd = false;
44};
45
46public ref struct PointPairs
47{
49
50 List<PointPair^>^ pairs;
52};
53
54public ref struct ICPProperties
55{
57 ICPMethod method = ICPMethod::PointToPlane;
58
60 float p2plAngleLimit = float( System::Math::PI ) / 6.0f; // [radians]
61
63 float p2plScaleLimit = 2;
64
66 float cosThreshold = 0.7f; // in [-1,1]
67
69 float distThresholdSq = 1.f; // [distance^2]
70
73 float farDistFactor = 3.f; // dimensionless
74
76 ICPMode icpMode = ICPMode::AnyRigidXf;
77
79 Vector3f^ fixedRotationAxis = gcnew Vector3f( 0, 0, 0 );
80
82 int iterLimit = 10;
83
86
88 float exitVal = 0; // [distance]
89
91 bool mutualClosest = false;
92
94};
95
96public ref class ICP
97{
98public:
103 ICP( MeshOrPointsXf^ flt, MeshOrPointsXf^ ref, float samplingVoxelSize );
104
110 ICP( MeshOrPointsXf^ flt, MeshOrPointsXf^ ref, BitSet^ fltSamples, BitSet^ refSamples );
113 void SetParams( ICPProperties^ props );
115 void SamplePoints( float sampleVoxelSize );
123 System::String^ GetStatusInfo();
139
140private:
141 MR::ICP* icp_;
142};
143
145
#define MR_DOTNET_NAMESPACE_BEGIN
Definition MRDotNet/MRMeshFwd.h:42
int VertId
Definition MRDotNet/MRMeshFwd.h:51
#define MR_DOTNET_NAMESPACE_END
Definition MRDotNet/MRMeshFwd.h:43
affine transformation: y = A*x + b, where A in VxV, and b in V
Definition MRDotNet/MRAffineXf.h:8
Definition MRDotNet/MRBitSet.h:39
Definition MRDotNet/MRICP.h:97
int GetNumSamples()
computes the number of samples able to form pairs
int GetNumActivePairs()
computes the number of active point pairs
void UpdatePointPairs()
recompute point pairs after manual change of transformations or parameters
void AutoSelectFloatXf()
void SetParams(ICPProperties^ props)
tune algorithm params before run calculateTransformation()
ICP(MeshOrPointsXf^ flt, MeshOrPointsXf^ ref, float samplingVoxelSize)
PointPairs GetFlt2RefPairs()
returns current pairs formed from samples on floating object and projections on reference object
~ICP()
AffineXf3f CalculateTransformation()
System::String GetStatusInfo()
returns status info string
ICP(MeshOrPointsXf^ flt, MeshOrPointsXf^ ref, BitSet^ fltSamples, BitSet^ refSamples)
void SamplePoints(float sampleVoxelSize)
select pairs with origin samples on both objects
float GetMeanSqDistToPoint()
computes root-mean-square deviation between points
float GetMeanSqDistToPlane()
computes root-mean-square deviation from points to target planes
PointPairs GetRef2FltPairs()
returns current pairs formed from samples on reference object and projections on floating object
Definition MRMesh/MRICP.h:169
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
Definition MRDotNet/MRICP.h:55
Vector3f fixedRotationAxis
If this vector is not zero then rotation is allowed relative to this axis only.
Definition MRDotNet/MRICP.h:79
float p2plScaleLimit
Scaling during one iteration of PointToPlane will be limited by this value.
Definition MRDotNet/MRICP.h:63
float cosThreshold
Points pair will be counted only if cosine between surface normals in points is higher.
Definition MRDotNet/MRICP.h:66
float p2plAngleLimit
Rotation angle during one iteration of PointToPlane will be limited by this value.
Definition MRDotNet/MRICP.h:60
int badIterStopCount
maximum iterations without improvements
Definition MRDotNet/MRICP.h:85
bool mutualClosest
a pair of points is formed only if both points in the pair are mutually closest (reciprocity test pas...
Definition MRDotNet/MRICP.h:91
int iterLimit
maximum iterations
Definition MRDotNet/MRICP.h:82
float distThresholdSq
Points pair will be counted only if squared distance between points is lower than.
Definition MRDotNet/MRICP.h:69
ICPMode icpMode
Finds only translation. Rotation part is identity matrix.
Definition MRDotNet/MRICP.h:76
float exitVal
Algorithm target root-mean-square distance. As soon as it is reached, the algorithm stops.
Definition MRDotNet/MRICP.h:88
float farDistFactor
Definition MRDotNet/MRICP.h:73
ICPMethod method
The method how to update transformation from point pairs.
Definition MRDotNet/MRICP.h:57
MR::ICPProperties ToNative()
Definition MRMesh/MRICP.h:119
Definition MRMesh/MRICP.h:74
holds together mesh/point cloud and its transformation
Definition MRDotNet/MRMeshOrPoints.h:21
Stores a pair of points: one samples on the source and the closest to it on the target.
Definition MRDotNet/MRICP.h:13
bool tgtOnBd
true if if the closest point on target is located on the boundary (only for meshes)
Definition MRDotNet/MRICP.h:43
VertId srcVertId
id of the source point
Definition MRDotNet/MRICP.h:33
Vector3f srcNorm
normal in source point after transforming in world space
Definition MRDotNet/MRICP.h:18
float distSq
squared distance between source and target points
Definition MRDotNet/MRICP.h:27
float weight
weight of the pair (to prioritize over other pairs)
Definition MRDotNet/MRICP.h:30
Vector3f tgtPoint
coordinates of the closest point on target after transforming in world space
Definition MRDotNet/MRICP.h:21
VertId tgtCloseVert
Definition MRDotNet/MRICP.h:37
Vector3f tgtNorm
normal in the target point after transforming in world space
Definition MRDotNet/MRICP.h:24
float normalsAngleCos
cosine between normals in source and target points
Definition MRDotNet/MRICP.h:40
Vector3f srcPoint
coordinates of the source point after transforming in world space
Definition MRDotNet/MRICP.h:15
Definition MRDotNet/MRICP.h:47
List< PointPair^> pairs
Definition MRDotNet/MRICP.h:50
PointPairs(const MR::PointPairs &pairs)
BitSet active
Definition MRDotNet/MRICP.h:51