MeshLib
 
Loading...
Searching...
No Matches
MRMeshC/MRICP.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRAffineXf.h"
5#include "MRId.h"
6#include "MRMeshOrPoints.h"
7#include "MRVector3.h"
8
10
23
38
54
69
72
74
76
78
93
122
125
128typedef struct MRICP MRICP;
129
131MRMESHC_API MRICP* mrICPNew( const MRMeshOrPointsXf* flt, const MRMeshOrPointsXf* ref, float samplingVoxelSize );
132
135
137MRMESHC_API void mrICPSamplePoints( MRICP* icp, float samplingVoxelSize );
138
143
146
149
152
155
158
161
164
167
171
174
MRMESHC_API float mrICPGetMeanSqDistToPlane(const MRICP *icp)
computes root-mean-square deviation from points to target planes
struct MRPointPair MRPointPair
Stores a pair of points: one samples on the source and the closest to it on the target.
struct MRPointPairs MRPointPairs
Definition MRMeshC/MRICP.h:73
MRMESHC_API float mrICPGetMeanSqDistToPoint(const MRICP *icp)
computes root-mean-square deviation between points
MRMESHC_API const MRIPointPairs * mrICPGetRef2FltPairs(const MRICP *icp)
returns current pairs formed from samples on reference object and projections on floating object
MRMESHC_API size_t mrICPGetNumSamples(const MRICP *icp)
computes the number of samples able to form pairs
MRMESHC_API void mrICPUpdatePointPairs(MRICP *icp)
recompute point pairs after manual change of transformations or parameters
struct MRICP MRICP
Definition MRMeshC/MRICP.h:128
MRICPMode
The group of transformations, each with its own degrees of freedom.
Definition MRMeshC/MRICP.h:26
@ MRICPModeTranslationOnly
only translation (3 degrees of freedom)
Definition MRMeshC/MRICP.h:36
@ MRICPModeOrthogonalAxis
rigid body transformation with rotation except argument axis (5 degrees of freedom)
Definition MRMeshC/MRICP.h:32
@ MRICPModeRigidScale
rigid body transformation with uniform scaling (7 degrees of freedom)
Definition MRMeshC/MRICP.h:28
@ MRICPModeFixedAxis
rigid body transformation with rotation around given axis only (4 degrees of freedom)
Definition MRMeshC/MRICP.h:34
@ MRICPModeAnyRigidXf
rigid body transformation (6 degrees of freedom)
Definition MRMeshC/MRICP.h:30
struct MRIPointPairs MRIPointPairs
Simple interface for pairs holder.
Definition MRMeshC/MRICP.h:71
MRMESHC_API MRAffineXf3f mrICPAutoSelectFloatXf(MRICP *icp)
MRMESHC_API const MRICPPairData * mrIPointPairsGet(const MRIPointPairs *pp, size_t idx)
MRMESHC_API void mrICPSamplePoints(MRICP *icp, float samplingVoxelSize)
select pairs with origin samples on both objects
MRMESHC_API void mrICPSetParams(MRICP *icp, const MRICPProperties *prop)
tune algorithm params before run calculateTransformation()
struct MRICPProperties MRICPProperties
MRMESHC_API MRAffineXf3f mrICPCalculateTransformation(MRICP *icp)
MRMESHC_API void mrICPFree(MRICP *icp)
deallocates an ICP object
struct MRICPPairData MRICPPairData
MRMESHC_API MRICPPairData * mrIPointPairsGetRef(MRIPointPairs *pp, size_t idx)
MRMESHC_API MRString * mrICPGetStatusInfo(const MRICP *icp)
returns status info string
MRICPMethod
The method how to update transformation from point pairs.
Definition MRMeshC/MRICP.h:13
@ MRICPMethodCombined
PointToPoint for the first 2 iterations, and PointToPlane for the remaining iterations.
Definition MRMeshC/MRICP.h:15
@ MRICPMethodPointToPoint
Definition MRMeshC/MRICP.h:18
@ MRICPMethodPointToPlane
Definition MRMeshC/MRICP.h:21
MRMESHC_API size_t mrICPGetNumActivePairs(const MRICP *icp)
computes the number of active point pairs
MRMESHC_API MRICPProperties mrICPPropertiesNew(void)
initializes a default instance
MRMESHC_API MRICP * mrICPNew(const MRMeshOrPointsXf *flt, const MRMeshOrPointsXf *ref, float samplingVoxelSize)
Constructs ICP framework with automatic points sampling on both objects.
MRICPExitType
types of exit conditions in calculation
Definition MRMeshC/MRICP.h:81
@ MRICPExitTypeNotFoundSolution
solution not found in some iteration
Definition MRMeshC/MRICP.h:85
@ MRICPExitTypeNotStarted
calculation is not started yet
Definition MRMeshC/MRICP.h:83
@ MRICPExitTypeMaxIterations
iteration limit reached
Definition MRMeshC/MRICP.h:87
@ MRICPExitTypeMaxBadIterations
limit of non-improvement iterations in a row reached
Definition MRMeshC/MRICP.h:89
@ MRICPExitTypeStopMsdReached
stop mean square deviation reached
Definition MRMeshC/MRICP.h:91
MRMESHC_API const MRIPointPairs * mrICPGetFlt2RefPairs(const MRICP *icp)
returns current pairs formed from samples on floating object and projections on reference object
#define MR_EXTERN_C_BEGIN
Definition MRMeshC/MRMeshFwd.h:26
#define MR_EXTERN_C_END
Definition MRMeshC/MRMeshFwd.h:27
typedefMR_EXTERN_C_BEGIN struct MRString MRString
Definition MRMeshC/MRMeshFwd.h:32
#define MRMESHC_API
Definition MRMeshC/MRMeshFwd.h:19
struct MRMeshOrPointsXf MRMeshOrPointsXf
an object and its transformation to global space with other objects
Definition MRMeshC/MRMeshOrPoints.h:20
affine transformation: y = A*x + b, where A in VxV, and b in V
Definition MRMeshC/MRAffineXf.h:10
Definition MRMeshC/MRICP.h:40
MRVector3f tgtNorm
normal in the target point after transforming in world space
Definition MRMeshC/MRICP.h:48
float distSq
squared distance between source and target points
Definition MRMeshC/MRICP.h:50
float weight
weight of the pair (to prioritize over other pairs)
Definition MRMeshC/MRICP.h:52
MRVector3f srcPoint
coordinates of the source point after transforming in world space
Definition MRMeshC/MRICP.h:42
MRVector3f srcNorm
normal in source point after transforming in world space
Definition MRMeshC/MRICP.h:44
MRVector3f tgtPoint
coordinates of the closest point on target after transforming in world space
Definition MRMeshC/MRICP.h:46
Definition MRMeshC/MRICP.h:95
float cosThreshold
Points pair will be counted only if cosine between surface normals in points is higher.
Definition MRMeshC/MRICP.h:103
MRVector3f fixedRotationAxis
If this vector is not zero then rotation is allowed relative to this axis only.
Definition MRMeshC/MRICP.h:112
float p2plScaleLimit
Scaling during one iteration of PointToPlane will be limited by this value.
Definition MRMeshC/MRICP.h:101
int badIterStopCount
maximum iterations without improvements
Definition MRMeshC/MRICP.h:116
MRICPMethod method
The method how to update transformation from point pairs.
Definition MRMeshC/MRICP.h:97
MRICPMode icpMode
Finds only translation. Rotation part is identity matrix.
Definition MRMeshC/MRICP.h:110
float farDistFactor
Definition MRMeshC/MRICP.h:108
int iterLimit
maximum iterations
Definition MRMeshC/MRICP.h:114
float p2plAngleLimit
Rotation angle during one iteration of PointToPlane will be limited by this value.
Definition MRMeshC/MRICP.h:99
bool mutualClosest
a pair of points is formed only if both points in the pair are mutually closest (reciprocity test pas...
Definition MRMeshC/MRICP.h:120
float exitVal
Algorithm target root-mean-square distance. As soon as it is reached, the algorithm stops.
Definition MRMeshC/MRICP.h:118
float distThresholdSq
Points pair will be counted only if squared distance between points is lower than.
Definition MRMeshC/MRICP.h:105
Stores a pair of points: one samples on the source and the closest to it on the target.
Definition MRMeshC/MRICP.h:57
bool tgtOnBd
true if if the closest point on target is located on the boundary (only for meshes)
Definition MRMeshC/MRICP.h:67
MRICPPairData ICPPairData
Definition MRMeshC/MRICP.h:58
float normalsAngleCos
cosine between normals in source and target points
Definition MRMeshC/MRICP.h:65
MRVertId tgtCloseVert
Definition MRMeshC/MRICP.h:63
MRVertId srcVertId
id of the source point
Definition MRMeshC/MRICP.h:60
three-dimensional vector
Definition MRMeshC/MRVector3.h:9
vertex index
Definition MRMeshC/MRId.h:12