MeshLib C++ Docs
Loading...
Searching...
No Matches
MRPointToPlaneAligningTransform.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRRigidScaleXf3.h"
5#include <MRPch/MREigenCore.h>
6
7namespace MR
8{
9
13
20{
21public:
23 MRMESH_API void add( const Vector3d& p1, const Vector3d& p2, const Vector3d& normal2, double w = 1 );
24
26 void add( const Vector3f& p1, const Vector3f& p2, const Vector3f& normal2, float w = 1 ) { add( Vector3d( p1 ), Vector3d( p2 ), Vector3d( normal2 ), w ); }
27
30
32 void clear() { *this = {}; }
33
37 void setStabilizer( double stabilizer ) { stabilizer_ = stabilizer; }
38 [[nodiscard]] double getStabilizer() const { return stabilizer_; }
39
43 [[nodiscard]] AffineXf3d findBestRigidXf() const { return calculateAmendment().rigidScaleXf(); }
44
46 [[nodiscard]] AffineXf3d findBestRigidScaleXf() const { return calculateAmendmentWithScale().rigidScaleXf(); }
47
49 [[nodiscard]] AffineXf3d findBestRigidXfFixedRotationAxis( const Vector3d & axis ) const { return calculateFixedAxisAmendment( axis ).rigidScaleXf(); }
50
52 [[nodiscard]] AffineXf3d findBestRigidXfOrthogonalRotationAxis( const Vector3d& ort ) const { return calculateOrthogonalAxisAmendment( ort ).rigidScaleXf(); }
53
55 [[nodiscard]] MRMESH_API Vector3d findBestTranslation( Vector3d rotAngles = {}, double scale = 1 ) const;
56
58 [[nodiscard]] MRMESH_API RigidScaleXf3d calculateAmendment() const;
59
61 [[nodiscard]] MRMESH_API RigidScaleXf3d calculateAmendmentWithScale() const;
62
64 [[nodiscard]] MRMESH_API RigidScaleXf3d calculateFixedAxisAmendment( const Vector3d & axis ) const;
65
67 [[nodiscard]] MRMESH_API RigidScaleXf3d calculateOrthogonalAxisAmendment( const Vector3d& ort ) const;
68
69private:
70 Eigen::Matrix<double, 7, 7> sumA_ = Eigen::Matrix<double, 7, 7>::Zero();
71 Eigen::Vector<double, 7> sumB_ = Eigen::Vector<double, 7>::Zero();
72 bool sumAIsSym_ = true;
73 double stabilizer_ = 0;
74
76 [[nodiscard]] Eigen::Matrix<double, 7, 7> stabilizedA_() const;
77};
78
80
81}
#define MRMESH_API
Definition MRMeshFwd.h:85
Definition MRPointToPlaneAligningTransform.h:20
double getStabilizer() const
Definition MRPointToPlaneAligningTransform.h:38
void add(const Vector3f &p1, const Vector3f &p2, const Vector3f &normal2, float w=1)
Add a pair of corresponding points and the normal of the tangent plane at the second point.
Definition MRPointToPlaneAligningTransform.h:26
RigidScaleXf3d calculateFixedAxisAmendment(const Vector3d &axis) const
this version searches for best transformation where rotation is allowed only around given axis and wi...
AffineXf3d findBestRigidXf() const
Definition MRPointToPlaneAligningTransform.h:43
void setStabilizer(double stabilizer)
Definition MRPointToPlaneAligningTransform.h:37
RigidScaleXf3d calculateAmendment() const
Compute transformation relative to given approximation and return it as angles and shift (scale = 1)
AffineXf3d findBestRigidXfFixedRotationAxis(const Vector3d &axis) const
this version searches for best transformation where rotation is allowed only around given axis and wi...
Definition MRPointToPlaneAligningTransform.h:49
RigidScaleXf3d calculateAmendmentWithScale() const
Compute transformation relative to given approximation and return it as scale, angles and shift.
void add(const Vector3d &p1, const Vector3d &p2, const Vector3d &normal2, double w=1)
Add a pair of corresponding points and the normal of the tangent plane at the second point.
void clear()
Clear points and normals data.
Definition MRPointToPlaneAligningTransform.h:32
Vector3d findBestTranslation(Vector3d rotAngles={}, double scale=1) const
this version searches for best translational part of affine transformation with given linear part
RigidScaleXf3d calculateOrthogonalAxisAmendment(const Vector3d &ort) const
this version searches for best transformation where rotation is allowed only around axes orthogonal t...
void prepare()
this method must be called after add() and before constant find...()/calculate...() to make the matri...
AffineXf3d findBestRigidXfOrthogonalRotationAxis(const Vector3d &ort) const
this version searches for best transformation where rotation is allowed only around axes orthogonal t...
Definition MRPointToPlaneAligningTransform.h:52
AffineXf3d findBestRigidScaleXf() const
this version searches for best rigid body transformation with uniform scaling
Definition MRPointToPlaneAligningTransform.h:46
Only strictly necessary for the bindings (to make MR::MeshIntersectionResult a complete type).
Definition MRCameraOrientationPlugin.h:8