MeshLib Documentation
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 [[nodiscard]] AffineXf3d findBestRigidXf() const { return calculateAmendment().rigidScaleXf(); }
38
40 [[nodiscard]] AffineXf3d findBestRigidScaleXf() const { return calculateAmendmentWithScale().rigidScaleXf(); }
41
43 [[nodiscard]] AffineXf3d findBestRigidXfFixedRotationAxis( const Vector3d & axis ) const { return calculateFixedAxisAmendment( axis ).rigidScaleXf(); }
44
46 [[nodiscard]] AffineXf3d findBestRigidXfOrthogonalRotationAxis( const Vector3d& ort ) const { return calculateOrthogonalAxisAmendment( ort ).rigidScaleXf(); }
47
49 [[nodiscard]] MRMESH_API Vector3d findBestTranslation( Vector3d rotAngles = {}, double scale = 1 ) const;
50
52 [[nodiscard]] MRMESH_API RigidScaleXf3d calculateAmendment() const;
53
55 [[nodiscard]] MRMESH_API RigidScaleXf3d calculateAmendmentWithScale() const;
56
58 [[nodiscard]] MRMESH_API RigidScaleXf3d calculateFixedAxisAmendment( const Vector3d & axis ) const;
59
61 [[nodiscard]] MRMESH_API RigidScaleXf3d calculateOrthogonalAxisAmendment( const Vector3d& ort ) const;
62
63private:
64 Eigen::Matrix<double, 7, 7> sumA_ = Eigen::Matrix<double, 7, 7>::Zero();
65 Eigen::Vector<double, 7> sumB_ = Eigen::Vector<double, 7>::Zero();
66 bool sumAIsSym_ = true;
67};
68
70
71} //namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRPointToPlaneAligningTransform.h:20
MRMESH_API 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 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
AffineXf3d findBestRigidXf() const
Definition MRPointToPlaneAligningTransform.h:37
MRMESH_API RigidScaleXf3d calculateOrthogonalAxisAmendment(const Vector3d &ort) const
this version searches for best transformation where rotation is allowed only around axes orthogonal t...
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:43
MRMESH_API RigidScaleXf3d calculateAmendment() const
Compute transformation relative to given approximation and return it as angles and shift (scale = 1)
MRMESH_API Vector3d findBestTranslation(Vector3d rotAngles={}, double scale=1) const
this version searches for best translational part of affine transformation with given linear part
void clear()
Clear points and normals data.
Definition MRPointToPlaneAligningTransform.h:32
MRMESH_API RigidScaleXf3d calculateFixedAxisAmendment(const Vector3d &axis) const
this version searches for best transformation where rotation is allowed only around given axis and wi...
MRMESH_API void prepare()
this method must be called after add() and before constant find...()/calculate...() to make the matri...
MRMESH_API RigidScaleXf3d calculateAmendmentWithScale() const
Compute transformation relative to given approximation and return it as scale, angles and shift.
AffineXf3d findBestRigidXfOrthogonalRotationAxis(const Vector3d &ort) const
this version searches for best transformation where rotation is allowed only around axes orthogonal t...
Definition MRPointToPlaneAligningTransform.h:46
AffineXf3d findBestRigidScaleXf() const
this version searches for best rigid body transformation with uniform scaling
Definition MRPointToPlaneAligningTransform.h:40
Definition MRCameraOrientationPlugin.h:8