HDK
|
#include <UT_Matrix3.h>
Public Types | |
typedef T | value_type |
Public Member Functions | |
SYS_FORCE_INLINE | UT_Matrix3T ()=default |
Construct uninitialized matrix. More... | |
constexpr | UT_Matrix3T (const UT_Matrix3T &)=default |
Default copy constructor. More... | |
constexpr | UT_Matrix3T (UT_Matrix3T &&)=default |
Default move constructor. More... | |
constexpr | UT_Matrix3T (fpreal64 val) noexcept |
Construct identity matrix, multipled by scalar. More... | |
UT_Matrix3T (const UT_Matrix4T< fpreal64 > &m) | |
template<typename S > | |
UT_Matrix3T (const UT_SymMatrix3T< S > m) | |
Construct from a symmetric 3x3 matrix. More... | |
UT_Matrix3T< T > & | operator= (const UT_Matrix3T< T > &m)=default |
Default copy assignment operator. More... | |
UT_Matrix3T< T > & | operator= (UT_Matrix3T< T > &&m)=default |
Default move assignment operator. More... | |
template<typename S > | |
UT_Matrix3T< T > & | operator= (const UT_Matrix3T< S > &m) noexcept |
template<typename S > | |
UT_Matrix3T< T > & | operator= (const UT_SymMatrix3T< S > &m) |
Convert from a symmetric matrix to non-symmetric. More... | |
UT_SymMatrix3T< T > | lowerTriangularSymMatrix3 () const |
Convert this to a symmetric matrix, using the lower-triangular portion. More... | |
UT_SymMatrix3T< T > | upperTriangularSymMatrix3 () const |
Convert this to a symmetric matrix, using the upper-triangular portion. More... | |
UT_SymMatrix3T< T > | averagedSymMatrix3 () const |
Convert this to a symmetric matrix, using averaged components. More... | |
UT_Matrix3T< T > | operator- () const |
SYS_FORCE_INLINE void | addScaledMat (T k, const UT_Matrix3T< T > &m) |
SYS_FORCE_INLINE UT_Matrix3T< T > & | operator+= (const UT_Matrix3T< T > &m) |
SYS_FORCE_INLINE UT_Matrix3T< T > & | operator-= (const UT_Matrix3T< T > &m) |
UT_Matrix3T< T > & | operator*= (const UT_Matrix3T< T > &m) |
template<typename S > | |
UT_Matrix3T< T > & | operator*= (const UT_SymMatrix3T< S > &m) |
Multiply given symmetric matrix on the right. More... | |
template<typename S > | |
void | leftMult (const UT_SymMatrix3T< S > &m) |
Multiply given symmetric matrix on the left. More... | |
template<typename S > | |
void | leftMult (const UT_Matrix3T< S > &m) |
Multiply given matrix3 on the left. More... | |
void | multiply3 (const UT_Matrix4 &m) |
void | multiply3 (const UT_DMatrix4 &m) |
constexpr bool | operator== (const UT_Matrix3T< T > &m) const noexcept |
constexpr bool | operator!= (const UT_Matrix3T< T > &m) const noexcept |
UT_Matrix3T< T > & | operator= (T val) |
SYS_FORCE_INLINE UT_Matrix3T< T > & | operator*= (T scalar) |
SYS_FORCE_INLINE UT_Matrix3T< T > & | operator/= (T scalar) |
template<typename S > | |
UT_Matrix3T< T > & | operator= (const UT_Vector3T< S > &vec) |
template<typename S > | |
UT_Matrix3T< T > & | operator+= (const UT_Vector3T< S > &vec) |
template<typename S > | |
UT_Matrix3T< T > & | operator-= (const UT_Vector3T< S > &vec) |
void | getBasis () |
void | arbitrary180rot () |
template<typename S > | |
void | arbitrary180rot (const UT_Vector3T< S > &v) |
template<typename S > | |
void | lookat (const UT_Vector3T< S > &from, const UT_Vector3T< S > &to, T roll=0) |
template<typename S > | |
void | lookat (const UT_Vector3T< S > &from, const UT_Vector3T< S > &to, const UT_Vector3T< S > &up) |
template<typename S > | |
int | orient (UT_Vector3T< S > &dir, UT_Vector3T< S > &up, int norm=1) |
template<typename S > | |
int | orientInverse (UT_Vector3T< S > &dir, UT_Vector3T< S > &up, int norm=1) |
template<typename S > | |
void | orientT (const UT_Vector3T< S > &v, T pscale, const UT_Vector3T< S > *s3, const UT_Vector3T< S > *up, const UT_QuaternionT< S > *q) |
void | orient (const UT_Vector3F &v, T pscale, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q) |
void | orient (const UT_Vector3D &v, T pscale, const UT_Vector3D *s3, const UT_Vector3D *up, const UT_QuaternionD *q) |
template<typename S > | |
void | orientInverseT (const UT_Vector3T< S > &v, T pscale, const UT_Vector3T< S > *s3, const UT_Vector3T< S > *up, const UT_QuaternionT< S > *q) |
void | orientInverse (const UT_Vector3F &v, T pscale, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q) |
void | orientInverse (const UT_Vector3D &v, T pscale, const UT_Vector3D *s3, const UT_Vector3D *up, const UT_QuaternionD *q) |
SYS_FORCE_INLINE T | coFactor (int k, int l) const |
T | determinant () const |
T | trace () const |
template<typename S > | |
int | eigenvalues (UT_Vector3T< S > &r, UT_Vector3T< S > &i) const |
int | invert () |
int | invert (UT_Matrix3T< T > &m) const |
int | invertKramer (UT_Matrix3T< T > &m, T abs_det_threshold=FLT_EPSILON) const |
int | invertKramer (T abs_det_threshold=FLT_EPSILON) |
int | safeInvertSymmetric (T tol=1e-6f) |
bool | diagonalizeSymmetric (UT_Matrix3T< T > &R, UT_Matrix3T< T > &D, T tol=1e-6f, int maxiter=100) const |
void | svdDecomposition (UT_Matrix3T< T > &U, UT_Matrix3T< T > &S, UT_Matrix3T< T > &V, T tol=1e-6f) const |
void | splitCovarianceToRotationScale (UT_Matrix3T< T > &R, UT_Matrix3T< T > &S, T tol=1e-6f) const |
bool | isSymmetric (T tolerance=T(SYS_FTOLERANCE)) const |
void | transpose () |
UT_Matrix3T< T > | transposedCopy () const |
bool | isEqual (const UT_Matrix3T< T > &m, T tolerance=T(SYS_FTOLERANCE)) const |
Check for equality within a tolerance level. More... | |
bool | isAlmostEqual (const UT_Matrix3T< T > &m, int ulps=50) const |
bool | isLowerTriangular (T tolerance=T(SYS_FTOLERANCE)) const |
Check for lower triangular within a tolerance level to 0. More... | |
template<UT_Axis3::axis A, bool reverse = false> | |
SYS_FORCE_INLINE void | rotateQuarter () |
template<UT_Axis3::axis A> | |
SYS_FORCE_INLINE void | rotateHalf () |
template<UT_Axis3::axis A> | |
SYS_FORCE_INLINE void | rotateWithQTurns (T theta, uint qturns) |
template<UT_Axis3::axis A, bool reverse = false> | |
SYS_FORCE_INLINE void | prerotateQuarter () |
template<UT_Axis3::axis A> | |
SYS_FORCE_INLINE void | prerotateHalf () |
SYS_FORCE_INLINE void | negate () |
Negates this matrix, i.e. multiplies it by -1. More... | |
template<typename S > | |
bool | decompose (const UT_XformOrder &order, UT_Vector3T< S > &rot, UT_Matrix3T< T > &stretch, const int max_iter=64, const T rel_tol=FLT_EPSILON) const |
template<typename S > | |
void | compose (const UT_XformOrder &order, const UT_Vector3T< S > &rot, const UT_Matrix3T< T > &stretch) |
bool | polarDecompose (UT_Matrix3T< T > *stretch=nullptr, bool reverse=true, const int max_iter=64, const T rel_tol=FLT_EPSILON) |
bool | makeRotationMatrix (UT_Matrix3T< T > *stretch=nullptr, bool reverse=true, const int max_iter=64, const T rel_tol=FLT_EPSILON) |
template<typename S > | |
void | extractScales2D (UT_Vector2T< S > &scales, S *shears=0) |
template<typename S > | |
void | rightExtractScales (UT_Vector3T< S > &scales, UT_Vector3T< S > *shears=nullptr) |
template<typename S > | |
void | rightExtractScales2D (UT_Vector2T< S > &scales, S *shears=nullptr) |
void | shearXY (T val) |
void | shearXZ (T val) |
void | shearYZ (T val) |
template<typename S > | |
int | solve (T cx, T cy, T cz, UT_Vector3T< S > &result) const |
template<typename S > | |
int | solve (const UT_Vector3T< S > &b, UT_Vector3T< S > &result) const |
template<typename S > | |
int | solveTranspose (T cx, T cy, T cz, UT_Vector3T< S > &result) const |
template<typename S > | |
int | solveTranspose (const UT_Vector3T< S > &b, UT_Vector3T< S > &result) const |
template<typename S > | |
void | changeSpace (UT_Vector3T< S > &iSrc, UT_Vector3T< S > &jSrc, UT_Vector3T< S > &iDest, UT_Vector3T< S > &jDest, int norm=1) |
void | xform (const UT_XformOrder &order, T tx=0, T ty=0, T rz=0, T sx=1, T sy=1, T px=0, T py=0, int reverse=0) |
void | xform (const UT_XformOrder &order, T tx, T ty, T rz, T sx, T sy, T s_xy, T px, T py, int reverse=0) |
template<typename S > | |
void | stretch (UT_Vector3T< S > &v, T amount, int norm=1) |
template<typename S > | |
UT_Matrix3T< T > | stretch (UT_Vector3T< S > &v, T amount, int norm=1) const |
int | isNormalized () const |
T | dot (unsigned i, unsigned j) const |
void | identity () |
Set the matrix to identity. More... | |
void | zero () |
Set the matrix to zero. More... | |
bool | isIdentity () const |
bool | isZero () const |
unsigned | hash () const |
Compute a hash. More... | |
T | dot (const UT_Matrix3T< T > &m) const |
T | getEuclideanNorm () const |
T | getEuclideanNorm2 () const |
Euclidean norm squared. More... | |
T | distanceSquared (const UT_Matrix3T< T > &src) |
T | getNorm1 () const |
T | getNormInf () const |
T | getNormMax () const |
T | getNormSpectral () const |
int | save (std::ostream &os, int binary) const |
bool | load (UT_IStream &is) |
void | outAsciiNoName (std::ostream &os) const |
UT_Matrix3T< T > & | operator= (const UT_Matrix4T< fpreal32 > &m) |
UT_Matrix3T< T > & | operator= (const UT_Matrix4T< fpreal64 > &m) |
template<typename S > | |
void | outerproductUpdateT (T b, const UT_Vector3T< S > &v1, const UT_Vector3T< S > &v2) |
SYS_FORCE_INLINE void | outerproductUpdate (T b, const UT_Vector3F &v1, const UT_Vector3F &v2) |
SYS_FORCE_INLINE void | outerproductUpdate (T b, const UT_Vector3D &v1, const UT_Vector3D &v2) |
template<typename S > | |
void | rotate (UT_Vector3T< S > &axis, T theta, int norm=1) |
void | rotate (UT_Axis3::axis a, T theta) |
template<UT_Axis3::axis A> | |
void | rotate (T theta) |
template<typename S > | |
void | prerotate (UT_Vector3T< S > &axis, T theta, int norm=1) |
void | prerotate (UT_Axis3::axis a, T theta) |
template<UT_Axis3::axis A> | |
void | prerotate (T theta) |
void | prerotate (T rx, T ry, T rz, const UT_XformOrder &order) |
void | prerotate (const UT_Vector3T< T > &rad, const UT_XformOrder &order) |
void | rotate (T rx, T ry, T rz, const UT_XformOrder &ord) |
void | rotate (const UT_Vector3T< T > &rad, const UT_XformOrder &ord) |
void | scale (T sx, T sy, T sz) |
SYS_FORCE_INLINE void | scale (const UT_Vector3T< T > &s) |
void | prescale (T sx, T sy, T sz) |
SYS_FORCE_INLINE void | prescale (const UT_Vector3T< T > &s) |
void | translate (T dx, T dy) |
SYS_FORCE_INLINE void | translate (const UT_Vector2T< T > &delta) |
void | pretranslate (T dx, T dy) |
SYS_FORCE_INLINE void | pretranslate (const UT_Vector2T< T > &delta) |
template<typename S > | |
int | crack (UT_Vector3T< S > &rvec, const UT_XformOrder &order) const |
template<typename S > | |
int | crack2D (S &r) const |
template<typename S > | |
void | conditionRotateT (UT_Vector3T< S > *scales) |
void | conditionRotate (UT_Vector3F *scales=0) |
void | conditionRotate (UT_Vector3D *scales) |
template<typename S > | |
void | extractScalesT (UT_Vector3T< S > &scales, UT_Vector3T< S > *shears) |
void | extractScales (UT_Vector3D &scales, UT_Vector3D *shears=0) |
void | extractScales (UT_Vector3F &scales, UT_Vector3F *shears=0) |
void | extractScales (UT_Vector3T< fpreal16 > &scales, UT_Vector3T< fpreal16 > *shears=0) |
void | shear (T s_xy, T s_xz, T s_yz) |
SYS_FORCE_INLINE void | shear (const UT_Vector3T< T > &sh) |
const T * | data () const |
Return the raw matrix data. More... | |
T * | data () |
Return the raw matrix data. More... | |
SYS_FORCE_INLINE T & | operator() (unsigned row, unsigned col) noexcept |
Return a matrix entry. No bounds checking on subscripts. More... | |
SYS_FORCE_INLINE T | operator() (unsigned row, unsigned col) const noexcept |
Return a matrix entry. No bounds checking on subscripts. More... | |
T * | operator() (unsigned row) |
Return a matrix row. No bounds checking on subscript. More... | |
const T * | operator() (unsigned row) const |
Return a matrix row. No bounds checking on subscript. More... | |
const UT_Vector3T< T > & | operator[] (unsigned row) const |
Return a matrix row. No bounds checking on subscript. More... | |
UT_Vector3T< T > & | operator[] (unsigned row) |
Return a matrix row. No bounds checking on subscript. More... | |
bool | save (UT_JSONWriter &w) const |
bool | save (UT_JSONValue &v) const |
bool | load (UT_JSONParser &p) |
Static Public Member Functions | |
static const UT_Matrix3T< T > & | getIdentityMatrix () |
static int | entries () |
Returns the vector size. More... | |
template<typename S > | |
static UT_Matrix3T< T > | reflectMat (const UT_Vector3T< S > &plane_normal) |
template<typename S > | |
static UT_Matrix3T< T > | rotationMat (UT_Vector3T< S > &axis, T theta, int norm=1) |
static UT_Matrix3T< T > | rotationMat (UT_Axis3::axis a, T theta) |
Static Public Attributes | |
static constexpr int | tuple_size = 9 |
Friends | |
std::ostream & | operator<< (std::ostream &os, const UT_Matrix3T< T > &v) |
template<typename S > | |
int | dihedral (UT_Vector3T< S > &a, UT_Vector3T< S > &b, int norm=1) |
template<typename S > | |
static UT_Matrix3T< T > | dihedral (UT_Vector3T< S > &a, UT_Vector3T< S > &b, UT_Vector3T< S > &c, int norm=1) |
template<int ORDER> | |
void | rotate (T rx, T ry, T rz) |
static uint | reduceExactQuarterTurns (T &angle_degrees) |
This class implements a 3x3 float matrix in row-major order.
Most of Houdini operates with row vectors that are left-multiplied with matrices. e.g., z = v * M
This convention, combined with row-major order, is directly compatible with OpenGL matrix requirements.
Definition at line 92 of file UT_Matrix3.h.
typedef T UT_Matrix3T< T >::value_type |
Definition at line 96 of file UT_Matrix3.h.
|
default |
Construct uninitialized matrix.
|
default |
Default copy constructor.
|
default |
Default move constructor.
|
inlineexplicitnoexcept |
Construct identity matrix, multipled by scalar.
Definition at line 109 of file UT_Matrix3.h.
|
explicit |
|
inlineexplicit |
Construct from a symmetric 3x3 matrix.
Definition at line 160 of file UT_Matrix3.h.
|
inline |
Definition at line 234 of file UT_Matrix3.h.
void UT_Matrix3T< T >::arbitrary180rot | ( | ) |
void UT_Matrix3T< T >::arbitrary180rot | ( | const UT_Vector3T< S > & | v | ) |
|
inline |
Convert this to a symmetric matrix, using averaged components.
Definition at line 215 of file UT_Matrix3.h.
void UT_Matrix3T< T >::changeSpace | ( | UT_Vector3T< S > & | iSrc, |
UT_Vector3T< S > & | jSrc, | ||
UT_Vector3T< S > & | iDest, | ||
UT_Vector3T< S > & | jDest, | ||
int | norm = 1 |
||
) |
|
inline |
Definition at line 564 of file UT_Matrix3.h.
void UT_Matrix3T< T >::compose | ( | const UT_XformOrder & | order, |
const UT_Vector3T< S > & | rot, | ||
const UT_Matrix3T< T > & | stretch | ||
) |
Composes a 3x3 transform matrix given the rotation (in radians), and stretch matrix components. This is the inverse of the decompose method.
|
inline |
This method will condition the matrix so that it's a valid rotation matrix (i.e. crackable). Ideally, the scales should be removed first, but this method will attempt to do this as well. It will return the conditioned scales if a vector is passed in. WARNING: If you just want a rotation matrix, use makeRotationMatrix()!
Definition at line 989 of file UT_Matrix3.h.
|
inline |
This method will condition the matrix so that it's a valid rotation matrix (i.e. crackable). Ideally, the scales should be removed first, but this method will attempt to do this as well. It will return the conditioned scales if a vector is passed in. WARNING: If you just want a rotation matrix, use makeRotationMatrix()!
Definition at line 991 of file UT_Matrix3.h.
void UT_Matrix3T< T >::conditionRotateT | ( | UT_Vector3T< S > * | scales | ) |
This method will condition the matrix so that it's a valid rotation matrix (i.e. crackable). Ideally, the scales should be removed first, but this method will attempt to do this as well. It will return the conditioned scales if a vector is passed in. WARNING: If you just want a rotation matrix, use makeRotationMatrix()!
int UT_Matrix3T< T >::crack | ( | UT_Vector3T< S > & | rvec, |
const UT_XformOrder & | order | ||
) | const |
Generate the x, y, and z values of rotation in radians. Return 0 if successful, and a non-zero value otherwise: 1 if the matrix is not a valid rotation matrix, 2 if rotOrder is invalid, and 3 for other errors. rotOrder must be given as a UT_XformOrder permulation. WARNING: For animation or transform blending, use polarDecompose() or makeRotationMatrix()!
Generate the x, y, and z values of rotation in radians. Return 0 if successful, and a non-zero value otherwise: 1 if the matrix is not a valid rotation matrix, 2 if rotOrder is invalid, and 3 for other errors. rotOrder must be given as a UT_XformOrder permulation. WARNING: For animation or transform blending, use polarDecompose() or makeRotationMatrix()!
|
inline |
Return the raw matrix data.
Definition at line 1158 of file UT_Matrix3.h.
|
inline |
Return the raw matrix data.
Definition at line 1159 of file UT_Matrix3.h.
bool UT_Matrix3T< T >::decompose | ( | const UT_XformOrder & | order, |
UT_Vector3T< S > & | rot, | ||
UT_Matrix3T< T > & | stretch, | ||
const int | max_iter = 64 , |
||
const T | rel_tol = FLT_EPSILON |
||
) | const |
Extract the rotation (in radians), and stretch components of the 3x3 matrix, preferably using polar decomposition. This method is slower than alternatives (explode, crack), but provides better results for animation.
|
inline |
Definition at line 578 of file UT_Matrix3.h.
bool UT_Matrix3T< T >::diagonalizeSymmetric | ( | UT_Matrix3T< T > & | R, |
UT_Matrix3T< T > & | D, | ||
T | tol = 1e-6f , |
||
int | maxiter = 100 |
||
) | const |
|
static |
Compute the dihedral: return the matrix that computes the rotation around the axes normal to both a and b, (their cross product), by the angle which is between a and b. The resulting matrix maps a onto b. If a and b have the same direction, what comes out is the identity matrix. If a and b are opposed, the rotation is arbitrary180rot and the method returns a vector c of zeroes (check with !c); if all is OK, c != 0. The transformation is a symmetry around vector a, then a symmetry around (norm(a) and norm(b)). If a or b needs to be normalized, pass a non-zero value in norm. The second function places the result in *this, and returns 0 if a and b are not opposed; otherwise, it returns 1. It DOES NOT affect *this if they are opposed, so return must be checked.
int UT_Matrix3T< T >::dihedral | ( | UT_Vector3T< S > & | a, |
UT_Vector3T< S > & | b, | ||
int | norm = 1 |
||
) |
T UT_Matrix3T< T >::distanceSquared | ( | const UT_Matrix3T< T > & | src | ) |
Get the squared Euclidean distance between '*this' and 'from' Returns sum_ij(sqr(b_ij-a_ij))
|
inline |
Definition at line 1122 of file UT_Matrix3.h.
T UT_Matrix3T< T >::dot | ( | const UT_Matrix3T< T > & | m | ) | const |
Dot product with another matrix Does dot(a,b) = sum_ij a_ij * b_ij
int UT_Matrix3T< T >::eigenvalues | ( | UT_Vector3T< S > & | r, |
UT_Vector3T< S > & | i | ||
) | const |
Computes the eigenvalues. Returns number of real eigenvalues found. Uses UT_RootFinder::cubic
r | The real eigenvalues |
i | The imaginary eigenvalues |
|
inlinestatic |
Returns the vector size.
Definition at line 1252 of file UT_Matrix3.h.
|
inline |
Extract scales and shears leaving this as an orthogonal rotation matrix using the transform order Scales * Shears * Rotate.
Definition at line 1002 of file UT_Matrix3.h.
|
inline |
Extract scales and shears leaving this as an orthogonal rotation matrix using the transform order Scales * Shears * Rotate.
Definition at line 1004 of file UT_Matrix3.h.
|
inline |
Extract scales and shears leaving this as an orthogonal rotation matrix using the transform order Scales * Shears * Rotate.
Definition at line 1006 of file UT_Matrix3.h.
void UT_Matrix3T< T >::extractScales2D | ( | UT_Vector2T< S > & | scales, |
S * | shears = 0 |
||
) |
Extract scales and shears leaving this as an orthogonal rotation matrix (assuming it was only a 2D xform to begin with) using the transform order Rotate * Scales * Shears. The shears are XY.
void UT_Matrix3T< T >::extractScalesT | ( | UT_Vector3T< S > & | scales, |
UT_Vector3T< S > * | shears | ||
) |
Extract scales and shears leaving this as an orthogonal rotation matrix using the transform order Scales * Shears * Rotate.
void UT_Matrix3T< T >::getBasis | ( | ) |
|
inline |
Euclidean or Frobenius norm of a matrix. Does sqrt(sum(a_ij ^2))
Definition at line 1202 of file UT_Matrix3.h.
T UT_Matrix3T< T >::getEuclideanNorm2 | ( | ) | const |
Euclidean norm squared.
|
static |
T UT_Matrix3T< T >::getNorm1 | ( | ) | const |
Get the 1-norm of this matrix, assuming a row vector convention. Returns the maximum absolute row sum. ie. max_i(sum_j(abs(a_ij)))
T UT_Matrix3T< T >::getNormInf | ( | ) | const |
Get the inf-norm of this matrix, assuming a row vector convention. Returns the maximum absolute column sum. ie. max_j(sum_i(abs(a_ij)))
T UT_Matrix3T< T >::getNormMax | ( | ) | const |
Get the max-norm of this matrix Returns the maximum absolute entry. ie. max_j(max_i(abs(a_ij)))
T UT_Matrix3T< T >::getNormSpectral | ( | ) | const |
Get the spectral norm of this matrix Returns the maximum singular value.
|
inline |
Compute a hash.
Definition at line 1163 of file UT_Matrix3.h.
|
inline |
Set the matrix to identity.
Definition at line 1128 of file UT_Matrix3.h.
int UT_Matrix3T< T >::invert | ( | ) |
Invert this matrix and return 0 if OK, 1 if singular. If singular, the matrix will be in an undefined state.
int UT_Matrix3T< T >::invert | ( | UT_Matrix3T< T > & | m | ) | const |
Invert the matrix and return 0 if OK, 1 if singular. Puts the inverted matrix in m, and leaves this matrix unchanged. If singular, the inverted matrix will be in an undefined state.
int UT_Matrix3T< T >::invertKramer | ( | UT_Matrix3T< T > & | m, |
T | abs_det_threshold = FLT_EPSILON |
||
) | const |
Use Kramer's method to compute the matrix inverse If abs( det(m) ) <= abs_det_threshold, then return 1 without changing m Otherwise, return 0, storing the inverse matrix in m
NOTE: The default FLT_EPSILON is kept here to preserve existing behavior This is not a good default! The right threshold must be decided separately for each use case.
int UT_Matrix3T< T >::invertKramer | ( | T | abs_det_threshold = FLT_EPSILON | ) |
|
inline |
Definition at line 684 of file UT_Matrix3.h.
|
inline |
Check for equality within a tolerance level.
Definition at line 668 of file UT_Matrix3.h.
|
inline |
Definition at line 1132 of file UT_Matrix3.h.
|
inline |
Check for lower triangular within a tolerance level to 0.
Definition at line 703 of file UT_Matrix3.h.
int UT_Matrix3T< T >::isNormalized | ( | ) | const |
bool UT_Matrix3T< T >::isSymmetric | ( | T | tolerance = T(SYS_FTOLERANCE) | ) | const |
|
inline |
Definition at line 1144 of file UT_Matrix3.h.
|
inline |
Multiply given symmetric matrix on the left.
Definition at line 330 of file UT_Matrix3.h.
|
inline |
Multiply given matrix3 on the left.
Definition at line 355 of file UT_Matrix3.h.
bool UT_Matrix3T< T >::load | ( | UT_IStream & | is | ) |
bool UT_Matrix3T< T >::load | ( | UT_JSONParser & | p | ) |
Methods to serialize to a JSON stream. The matrix is stored as an array of 9 reals.
void UT_Matrix3T< T >::lookat | ( | const UT_Vector3T< S > & | from, |
const UT_Vector3T< S > & | to, | ||
T | roll = 0 |
||
) |
void UT_Matrix3T< T >::lookat | ( | const UT_Vector3T< S > & | from, |
const UT_Vector3T< S > & | to, | ||
const UT_Vector3T< S > & | up | ||
) |
|
inline |
Convert this to a symmetric matrix, using the lower-triangular portion.
Definition at line 199 of file UT_Matrix3.h.
bool UT_Matrix3T< T >::makeRotationMatrix | ( | UT_Matrix3T< T > * | stretch = nullptr , |
bool | reverse = true , |
||
const int | max_iter = 64 , |
||
const T | rel_tol = FLT_EPSILON |
||
) |
Turn this matrix into the "closest" rotation matrix.
It uses polarDecompose and then negates the matrix and stretch if there is a negative determinant (scale). It returns false iff polarDecompose failed, possibly due to a singular matrix.
This is currently the one true way to turn an arbitrary matrix into a rotation matrix. If that ever changes, put a warning here, and you may want to update UT_Matrix4::makeRigidMatrix too.
void UT_Matrix3T< T >::multiply3 | ( | const UT_Matrix4 & | m | ) |
void UT_Matrix3T< T >::multiply3 | ( | const UT_DMatrix4 & | m | ) |
|
inline |
Negates this matrix, i.e. multiplies it by -1.
Definition at line 879 of file UT_Matrix3.h.
|
inlinenoexcept |
Definition at line 385 of file UT_Matrix3.h.
|
inlinenoexcept |
Return a matrix entry. No bounds checking on subscripts.
Definition at line 1167 of file UT_Matrix3.h.
|
inlinenoexcept |
Return a matrix entry. No bounds checking on subscripts.
Definition at line 1173 of file UT_Matrix3.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 1182 of file UT_Matrix3.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 1187 of file UT_Matrix3.h.
|
inline |
Definition at line 281 of file UT_Matrix3.h.
|
inline |
Multiply given symmetric matrix on the right.
Definition at line 303 of file UT_Matrix3.h.
|
inline |
Definition at line 399 of file UT_Matrix3.h.
|
inline |
Definition at line 249 of file UT_Matrix3.h.
|
inline |
Definition at line 1326 of file UT_Matrix3.h.
|
inline |
Definition at line 225 of file UT_Matrix3.h.
|
inline |
Definition at line 265 of file UT_Matrix3.h.
|
inline |
Definition at line 1338 of file UT_Matrix3.h.
|
inline |
Definition at line 407 of file UT_Matrix3.h.
|
default |
Default copy assignment operator.
|
default |
Default move assignment operator.
UT_Matrix3T<T>& UT_Matrix3T< T >::operator= | ( | const UT_Matrix4T< fpreal32 > & | m | ) |
Conversion operator that returns a 3x3 from a 4x4 matrix by ignoring the last row and last column.
UT_Matrix3T<T>& UT_Matrix3T< T >::operator= | ( | const UT_Matrix4T< fpreal64 > & | m | ) |
Conversion operator that returns a 3x3 from a 4x4 matrix by ignoring the last row and last column.
|
inlinenoexcept |
Definition at line 178 of file UT_Matrix3.h.
|
inline |
Convert from a symmetric matrix to non-symmetric.
Definition at line 188 of file UT_Matrix3.h.
|
inline |
Definition at line 391 of file UT_Matrix3.h.
|
inline |
Definition at line 1315 of file UT_Matrix3.h.
|
inlinenoexcept |
Definition at line 378 of file UT_Matrix3.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 1452 of file UT_Matrix3.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 1460 of file UT_Matrix3.h.
int UT_Matrix3T< T >::orient | ( | UT_Vector3T< S > & | dir, |
UT_Vector3T< S > & | up, | ||
int | norm = 1 |
||
) |
|
inline |
Definition at line 534 of file UT_Matrix3.h.
|
inline |
Definition at line 539 of file UT_Matrix3.h.
int UT_Matrix3T< T >::orientInverse | ( | UT_Vector3T< S > & | dir, |
UT_Vector3T< S > & | up, | ||
int | norm = 1 |
||
) |
|
inline |
Definition at line 549 of file UT_Matrix3.h.
|
inline |
Definition at line 554 of file UT_Matrix3.h.
void UT_Matrix3T< T >::orientInverseT | ( | const UT_Vector3T< S > & | v, |
T | pscale, | ||
const UT_Vector3T< S > * | s3, | ||
const UT_Vector3T< S > * | up, | ||
const UT_QuaternionT< S > * | q | ||
) |
void UT_Matrix3T< T >::orientT | ( | const UT_Vector3T< S > & | v, |
T | pscale, | ||
const UT_Vector3T< S > * | s3, | ||
const UT_Vector3T< S > * | up, | ||
const UT_QuaternionT< S > * | q | ||
) |
void UT_Matrix3T< T >::outAsciiNoName | ( | std::ostream & | os | ) | const |
|
inline |
Scaled outer product update (given scalar b, row vectors v1 and v2) this += b * transpose(v1) * v2
Definition at line 428 of file UT_Matrix3.h.
|
inline |
Scaled outer product update (given scalar b, row vectors v1 and v2) this += b * transpose(v1) * v2
Definition at line 433 of file UT_Matrix3.h.
|
inline |
Scaled outer product update (given scalar b, row vectors v1 and v2) this += b * transpose(v1) * v2
Definition at line 1431 of file UT_Matrix3.h.
bool UT_Matrix3T< T >::polarDecompose | ( | UT_Matrix3T< T > * | stretch = nullptr , |
bool | reverse = true , |
||
const int | max_iter = 64 , |
||
const T | rel_tol = FLT_EPSILON |
||
) |
Perform the polar decomposition M into an orthogonal matrix Q and an symmetric positive-semidefinite matrix S. This is more useful than crack() or conditionRotate() when the desire is to blend transforms. By default, it gives M=SQ, a left polar decomposition. If reverse is false, then it gives M=QS, a right polar decomposition.
void UT_Matrix3T< T >::prerotate | ( | UT_Vector3T< S > & | axis, |
T | theta, | ||
int | norm = 1 |
||
) |
Pre-multiply this matrix by the theta radians rotation around the axis
void UT_Matrix3T< T >::prerotate | ( | UT_Axis3::axis | a, |
T | theta | ||
) |
Pre-multiply this matrix by the theta radians rotation around the axis
Pre-multiply this matrix by the theta radians rotation around the axis
void UT_Matrix3T< T >::prerotate | ( | T | rx, |
T | ry, | ||
T | rz, | ||
const UT_XformOrder & | order | ||
) |
Pre-rotate by rx, ry, rz radians around the three basic axes in the order given by UT_XformOrder.
|
inline |
Pre-rotate by rx, ry, rz radians around the three basic axes in the order given by UT_XformOrder.
Definition at line 838 of file UT_Matrix3.h.
|
inline |
Pre-multiply this matrix by a 3x3 rotation matrix (on the left) for a half turn (180 degrees) around the specified axis
Definition at line 822 of file UT_Matrix3.h.
|
inline |
Pre-multiply this matrix by a 3x3 rotation matrix (on the left) for a quarter turn (90 degrees) around the specified axis
Definition at line 796 of file UT_Matrix3.h.
Pre-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 867 of file UT_Matrix3.h.
|
inline |
Pre-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 874 of file UT_Matrix3.h.
|
inline |
Pre-multiply this matrix by the translation matrix determined by (dx,dy)
Definition at line 904 of file UT_Matrix3.h.
|
inline |
Pre-multiply this matrix by the translation matrix determined by (dx,dy)
Definition at line 911 of file UT_Matrix3.h.
|
static |
If angle_degrees is an exact multiple of 90, it is changed to 0, and the quarter turn number (0-3) is returned. If angle_degrees is not an exact multiple of 90, it is left unchanged, and 0 is returned.
|
inlinestatic |
Create a reflection matrix for the given normal to the mirror plane. 'plane_normal' should be normalized.
Definition at line 443 of file UT_Matrix3.h.
void UT_Matrix3T< T >::rightExtractScales | ( | UT_Vector3T< S > & | scales, |
UT_Vector3T< S > * | shears = nullptr |
||
) |
Extract scales and shears leaving this as an orthogonal rotation matrix using the transform order Rotate * Scales * Shears.
void UT_Matrix3T< T >::rightExtractScales2D | ( | UT_Vector2T< S > & | scales, |
S * | shears = nullptr |
||
) |
Extract scales and shears leaving this as an orthogonal rotation matrix (assuming it was only a 2D xform to begin with) using the transform order Scales * Shears * Rotate. The shears are XY.
void UT_Matrix3T< T >::rotate | ( | UT_Vector3T< S > & | axis, |
T | theta, | ||
int | norm = 1 |
||
) |
Post-multiply this matrix by a 3x3 rotation matrix determined by the axis and angle of rotation in radians. If 'norm' is not 0, the axis vector is normalized before computing the rotation matrix. rotationMat() returns a rotation matrix, and could as well be defined as a free floating function.
void UT_Matrix3T< T >::rotate | ( | UT_Axis3::axis | a, |
T | theta | ||
) |
Post-multiply this matrix by a 3x3 rotation matrix determined by the axis and angle of rotation in radians. If 'norm' is not 0, the axis vector is normalized before computing the rotation matrix. rotationMat() returns a rotation matrix, and could as well be defined as a free floating function.
Post-multiply this matrix by a 3x3 rotation matrix determined by the axis and angle of rotation in radians. If 'norm' is not 0, the axis vector is normalized before computing the rotation matrix. rotationMat() returns a rotation matrix, and could as well be defined as a free floating function.
void UT_Matrix3T< T >::rotate | ( | T | rx, |
T | ry, | ||
T | rz, | ||
const UT_XformOrder & | ord | ||
) |
Post-rotate by rx, ry, rz radians around the three basic axes in the order given by UT_XformOrder.
|
inline |
Post-rotate by rx, ry, rz radians around the three basic axes in the order given by UT_XformOrder.
Definition at line 848 of file UT_Matrix3.h.
Post-rotate by rx, ry, rz radians around the three basic axes in the order given by a templated UT_XformOrder.
Definition at line 1736 of file UT_Matrix3.h.
|
inline |
Post-multiply this matrix by a 3x3 rotation matrix (on the right) for a half turn (180 degrees) around the specified axis
Definition at line 749 of file UT_Matrix3.h.
|
inline |
Post-multiply this matrix by a 3x3 rotation matrix (on the right) for a quarter turn (90 degrees) around the specified axis
Definition at line 726 of file UT_Matrix3.h.
|
inline |
This is just a helper function for code handling quarter turns exactly. NOTE: theta is in radians already, not degrees!
Definition at line 764 of file UT_Matrix3.h.
|
static |
Create a rotation matrix for the given angle in radians around the axis
|
static |
Create a rotation matrix for the given angle in radians around the axis
int UT_Matrix3T< T >::safeInvertSymmetric | ( | T | tol = 1e-6f | ) |
int UT_Matrix3T< T >::save | ( | std::ostream & | os, |
int | binary | ||
) | const |
bool UT_Matrix3T< T >::save | ( | UT_JSONWriter & | w | ) | const |
Methods to serialize to a JSON stream. The matrix is stored as an array of 9 reals.
bool UT_Matrix3T< T >::save | ( | UT_JSONValue & | v | ) | const |
Methods to serialize to a JSON stream. The matrix is stored as an array of 9 reals.
Post-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 854 of file UT_Matrix3.h.
|
inline |
Post-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 861 of file UT_Matrix3.h.
Post-multiply this matrix by the shear matrix formed by (sxy, sxz, syz)
Definition at line 1040 of file UT_Matrix3.h.
|
inline |
Post-multiply this matrix by the shear matrix formed by (sxy, sxz, syz)
Definition at line 1052 of file UT_Matrix3.h.
void UT_Matrix3T< T >::shearXY | ( | T | val | ) |
void UT_Matrix3T< T >::shearXZ | ( | T | val | ) |
void UT_Matrix3T< T >::shearYZ | ( | T | val | ) |
int UT_Matrix3T< T >::solve | ( | T | cx, |
T | cy, | ||
T | cz, | ||
UT_Vector3T< S > & | result | ||
) | const |
int UT_Matrix3T< T >::solve | ( | const UT_Vector3T< S > & | b, |
UT_Vector3T< S > & | result | ||
) | const |
int UT_Matrix3T< T >::solveTranspose | ( | T | cx, |
T | cy, | ||
T | cz, | ||
UT_Vector3T< S > & | result | ||
) | const |
int UT_Matrix3T< T >::solveTranspose | ( | const UT_Vector3T< S > & | b, |
UT_Vector3T< S > & | result | ||
) | const |
void UT_Matrix3T< T >::splitCovarianceToRotationScale | ( | UT_Matrix3T< T > & | R, |
UT_Matrix3T< T > & | S, | ||
T | tol = 1e-6f |
||
) | const |
Splits a covariance matrix into a scale & rotation component. This should be built by a series of outer product updates. R is the rotation component, S the inverse scale. If this is A, finds the inverse square root of AtA, S. We then set R = transpose(AS) to give us a rotation matrix. NOTE: For general matrices, use makeRotationMatrix()!
void UT_Matrix3T< T >::stretch | ( | UT_Vector3T< S > & | v, |
T | amount, | ||
int | norm = 1 |
||
) |
UT_Matrix3T<T> UT_Matrix3T< T >::stretch | ( | UT_Vector3T< S > & | v, |
T | amount, | ||
int | norm = 1 |
||
) | const |
void UT_Matrix3T< T >::svdDecomposition | ( | UT_Matrix3T< T > & | U, |
UT_Matrix3T< T > & | S, | ||
UT_Matrix3T< T > & | V, | ||
T | tol = 1e-6f |
||
) | const |
|
inline |
Definition at line 584 of file UT_Matrix3.h.
|
inline |
Post-multiply this matrix by a translation matrix determined by (dx,dy)
Definition at line 888 of file UT_Matrix3.h.
|
inline |
Post-multiply this matrix by a translation matrix determined by (dx,dy)
Definition at line 898 of file UT_Matrix3.h.
|
inline |
Definition at line 653 of file UT_Matrix3.h.
|
inline |
Definition at line 660 of file UT_Matrix3.h.
|
inline |
Convert this to a symmetric matrix, using the upper-triangular portion.
Definition at line 207 of file UT_Matrix3.h.
void UT_Matrix3T< T >::xform | ( | const UT_XformOrder & | order, |
T | tx = 0 , |
||
T | ty = 0 , |
||
T | rz = 0 , |
||
T | sx = 1 , |
||
T | sy = 1 , |
||
T | px = 0 , |
||
T | py = 0 , |
||
int | reverse = 0 |
||
) |
void UT_Matrix3T< T >::xform | ( | const UT_XformOrder & | order, |
T | tx, | ||
T | ty, | ||
T | rz, | ||
T | sx, | ||
T | sy, | ||
T | s_xy, | ||
T | px, | ||
T | py, | ||
int | reverse = 0 |
||
) |
|
inline |
Set the matrix to zero.
Definition at line 1130 of file UT_Matrix3.h.
|
friend |
Definition at line 1236 of file UT_Matrix3.h.
T UT_Matrix3T< T >::matx[3][3] |
Definition at line 1300 of file UT_Matrix3.h.
T UT_Matrix3T< T >::myFloats[tuple_size] |
Definition at line 1301 of file UT_Matrix3.h.
|
static |
Definition at line 97 of file UT_Matrix3.h.