18 const auto [q, r] = m.
qr();
22 for (
int i = 0; i < 3; ++i )
24 scaling[i][i] = std::abs( r[i][i] );
29 if ( signedScale && rotation.
det() < 0 )
33 for (
int i = 1; i < 3; ++i )
34 if ( rotation[i][i] < rotation[j][j] )
36 for (
int i = 0; i < 3; ++i )
37 rotation[i][j] = -rotation[i][j];
38 scaling[j][j] = -scaling[j][j];
48 auto eps = T( 10 ) * std::numeric_limits<T>::epsilon();
49 if ( std::abs( scale.x.x - T( 1 ) ) > eps )
51 if ( std::abs( scale.y.y - T( 1 ) ) > eps )
53 if ( std::abs( scale.z.z - T( 1 ) ) > eps )
void decomposeMatrix3(const Matrix3< T > &m, Matrix3< T > &rotation, Matrix3< T > &scaling, bool signedScale=false)
Definition MRMatrix3Decompose.h:16
constexpr T det() const noexcept
computes determinant of the matrix
bool isRigid(const Matrix3< T > &m)
Returns true if matrix scale is identity.
Definition MRMatrix3Decompose.h:44
QR qr() const noexcept
decompose this matrix on the product Q*R, where Q is orthogonal and R is upper triangular
Only strictly necessary for the bindings (to make MR::MeshIntersectionResult a complete type).
Definition MRCameraOrientationPlugin.h:8
Definition MRMatrix3.h:24