HDK
|
#include <UT_Matrix4.h>
Classes | |
struct | FullTransformModel |
Define parameters for Houdini's full transform model. More... | |
struct | PivotSpaceT |
Define parameters for Houdini's pivot space. More... | |
Public Types | |
enum | applyType { BEFORE =1, EQUAL =2, AFTER =4, BEFORE_EQUAL =4, AFTER_EQUAL =6 } |
typedef T | value_type |
typedef PivotSpaceT< T > | PivotSpace |
Public Member Functions | |
SYS_FORCE_INLINE | UT_Matrix4T ()=default |
Construct uninitialized matrix. More... | |
constexpr | UT_Matrix4T (const UT_Matrix4T &)=default |
Default copy constructor. More... | |
constexpr | UT_Matrix4T (UT_Matrix4T &&)=default |
Default move constructor. More... | |
constexpr | UT_Matrix4T (fpreal64 val) noexcept |
Construct identity matrix, multipled by scalar. More... | |
U | UT_Matrix4T (const UT_Matrix3T< S > &m, const UT_Vector3T< U > &t) |
template<typename S > | |
UT_Matrix4T (const UT_SymMatrix4T< S > &m) | |
UT_Matrix4T< T > & | operator= (const UT_Matrix4T< T > &m)=default |
Default copy assignment operator. More... | |
UT_Matrix4T< T > & | operator= (UT_Matrix4T< T > &&m)=default |
Default move assignment operator. More... | |
template<typename S > | |
UT_Matrix4T< T > & | operator= (const UT_Matrix4T< S > &m) |
template<typename S > | |
UT_Matrix4T< T > & | operator= (const UT_SymMatrix4T< S > &m) |
Conversion from a symmetric to a non symmetric matrix. More... | |
UT_Matrix4T< T > | operator- () const |
SYS_FORCE_INLINE UT_Matrix4T< T > & | operator+= (const UT_Matrix4T< T > &m) |
SYS_FORCE_INLINE UT_Matrix4T< T > & | operator-= (const UT_Matrix4T< T > &m) |
template<typename S > | |
UT_Matrix4T< T > & | operator*= (const UT_Matrix4T< S > &m) |
template<typename S > | |
UT_Matrix4T< T > & | operator*= (const UT_Matrix3T< S > &m) |
bool | operator== (const UT_Matrix4T< T > &m) const |
bool | operator!= (const UT_Matrix4T< T > &m) const |
UT_Matrix4T< T > & | operator= (fpreal64 v) |
SYS_FORCE_INLINE UT_Matrix4T< T > & | operator*= (T scalar) |
SYS_FORCE_INLINE UT_Matrix4T< T > & | operator/= (T scalar) |
template<typename S > | |
UT_Matrix4T< T > & | operator= (const UT_Vector4T< S > &vec) |
template<typename S > | |
UT_Matrix4T< T > & | operator+= (const UT_Vector4T< S > &vec) |
template<typename S > | |
UT_Matrix4T< T > & | operator-= (const UT_Vector4T< S > &vec) |
SYS_FORCE_INLINE T | coFactor (int k, int l) const |
T | determinant () const |
T | determinant3 () const |
Compute determinant of the upper-left 3x3 sub-matrix. More... | |
T | trace () const |
int | invertKramer () |
int | invertKramer (UT_Matrix4T< T > &m) const |
bool | diagonalizeSymmetric (UT_Matrix4T< T > &R, UT_Matrix4T< T > &D, T tol=1e-6f, int maxiter=100) const |
void | svdDecomposition (UT_Matrix4T< T > &U, UT_Matrix4T< T > &S, UT_Matrix4T< T > &V, T tol=1e-6f) const |
bool | isSymmetric (T tolerance=T(SYS_FTOLERANCE)) const |
template<typename S > | |
int | solve (const UT_Vector4T< S > &b, UT_Vector4T< S > &x) const |
template<typename S > | |
int | solveTranspose (const UT_Vector4T< S > &b, UT_Vector4T< S > &x) const |
template<typename S > | |
void | instanceT (const UT_Vector3T< S > &p, const UT_Vector3T< S > &v, T s, const UT_Vector3T< S > *s3, const UT_Vector3T< S > *up, const UT_QuaternionT< S > *q, const UT_Vector3T< S > *tr, const UT_QuaternionT< S > *orient, const UT_Vector3T< S > *pivot) |
void | instance (const UT_Vector3F &p, const UT_Vector3F &v, T s, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q, const UT_Vector3F *tr, const UT_QuaternionF *orient, const UT_Vector3F *pivot=NULL) |
void | instance (const UT_Vector3D &p, const UT_Vector3D &v, T s, const UT_Vector3D *s3, const UT_Vector3D *up, const UT_QuaternionD *q, const UT_Vector3D *tr, const UT_QuaternionD *orient, const UT_Vector3D *pivot=NULL) |
template<typename S > | |
void | instanceInverseT (const UT_Vector3T< S > &p, const UT_Vector3T< S > &v, T s, const UT_Vector3T< S > *s3, const UT_Vector3T< S > *up, const UT_QuaternionT< S > *q, const UT_Vector3T< S > *tr, const UT_QuaternionT< S > *orient, const UT_Vector3T< S > *pivot) |
void | instanceInverse (const UT_Vector3F &p, const UT_Vector3F &v, T s, const UT_Vector3F *s3, const UT_Vector3F *up, const UT_QuaternionF *q, const UT_Vector3F *tr, const UT_QuaternionF *orient, const UT_Vector3F *pivot=NULL) |
void | instanceInverse (const UT_Vector3D &p, const UT_Vector3D &v, T s, const UT_Vector3D *s3, const UT_Vector3D *up, const UT_QuaternionD *q, const UT_Vector3D *tr, const UT_QuaternionD *orient, const UT_Vector3D *pivot=NULL) |
void | transpose () |
UT_Matrix4T< T > | transpose () const |
bool | isEqual (const UT_Matrix4T< T > &m, T tolerance=T(SYS_FTOLERANCE)) const |
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 () |
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 tz=0, T rx=0, T ry=0, T rz=0, T sx=1, T sy=1, T sz=1, T px=0, T py=0, T pz=0, int reverse=0) |
void | xform (const UT_XformOrder &order, T tx, T ty, T tz, T rx, T ry, T rz, T sx, T sy, T sz, T s_xy, T s_xz, T s_yz, T px, T py, T pz, int reverse=0) |
void | xform (const UT_XformOrder &order, T tx, T ty, T tz, T rx, T ry, T rz, T sx, T sy, T sz, const PivotSpace &pivot, int reverse=0) |
void | xform (const UT_XformOrder &order, T tx, T ty, T tz, T rx, T ry, T rz, T sx, T sy, T sz, T s_xy, T s_xz, T s_yz, const PivotSpace &pivot, int reverse=0) |
void | xform (const FullTransformModel &parms, T min_abs_scale=T(0)) |
void | xform (const UT_XformOrder &order, applyType type, char limit, T tx, T ty, T tz, T rx, T ry, T rz, T sx, T sy, T sz, T px, T py, T pz) |
void | rotate (const UT_XformOrder &order, applyType type, char limit, T rx, T ry, T rz) |
template<typename S > | |
void | getTranslates (UT_Vector3T< S > &translates) const |
template<typename S > | |
void | setTranslates (const UT_Vector3T< S > &translates) |
template<typename S > | |
int | explodeT (const UT_XformOrder &order, UT_Vector3T< S > &r, UT_Vector3T< S > &s, UT_Vector3T< S > &t, UT_Vector3T< S > *shears) const |
int | explode (const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, UT_Vector3F *shears=0) const |
int | explode (const UT_XformOrder &order, UT_Vector3D &r, UT_Vector3D &s, UT_Vector3D &t, UT_Vector3D *shears=0) const |
template<typename S > | |
int | explodeT (const UT_XformOrder &order, UT_Vector3T< S > &r, UT_Vector3T< S > &s, UT_Vector3T< S > &t, const UT_Vector3T< S > &p, UT_Vector3T< S > *shears) const |
int | explode (const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, const UT_Vector3F &p, UT_Vector3F *shears=0) const |
int | explode (const UT_XformOrder &order, UT_Vector3D &r, UT_Vector3D &s, UT_Vector3D &t, const UT_Vector3D &p, UT_Vector3D *shears=0) const |
template<typename S > | |
int | explodeT (const UT_XformOrder &order, UT_Vector3T< S > &r, UT_Vector3T< S > &s, UT_Vector3T< S > &t, const PivotSpaceT< S > &p, UT_Vector3T< S > *shears) const |
int | explode (const UT_XformOrder &order, UT_Vector3F &r, UT_Vector3F &s, UT_Vector3F &t, const PivotSpaceT< fpreal32 > &p, UT_Vector3F *shears=0) const |
int | explode (const UT_XformOrder &order, UT_Vector3D &r, UT_Vector3D &s, UT_Vector3D &t, const PivotSpaceT< fpreal64 > &p, UT_Vector3D *shears=0) const |
template<typename S > | |
int | explode2D (const UT_XformOrder &order, S &r, UT_Vector2T< S > &s, UT_Vector2T< S > &t, S *shears=0) const |
template<typename S > | |
int | explode2D (const UT_XformOrder &order, S &r, UT_Vector2T< S > &s, UT_Vector2T< S > &t, const UT_Vector2T< S > &p, S *shears=0) const |
template<typename S > | |
void | extractRotate (UT_Matrix3T< S > &dst) const |
template<typename S > | |
bool | decompose (const UT_XformOrder &order, UT_Vector3T< S > &trn, 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, UT_Vector3T< S > &trn, UT_Vector3T< S > &rot, 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 | makeRigidMatrix (UT_Matrix3T< T > *stretch=nullptr, bool reverse=true, const int max_iter=64, const T rel_tol=FLT_EPSILON) |
template<typename S > | |
void | stretch (UT_Vector3T< S > &v, T amount, int norm=1) |
T | dot (unsigned i, unsigned j) const |
template<typename S > | |
void | outerproductUpdate (T b, const UT_Vector4T< S > &v1, const UT_Vector4T< S > &v2) |
void | lerp (const UT_Matrix4T< T > &a, const UT_Matrix4T< T > &b, T t) |
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_Matrix4T< T > &m) const |
T | getEuclideanNorm () const |
T | getEuclideanNorm2 () const |
Euclidean norm squared. More... | |
T | getNorm1 () const |
T | getNormInf () const |
T | getNormMax () const |
T | getNormSpectral () const |
T | getInfinityNorm () const |
L-Infinity Norm, but using col vector convention. More... | |
UT_Matrix4T< T > & | exp (int q) |
Compute the exponential of A using Pade approximants with scaling and squaring by q. More... | |
UT_Matrix4T< T > & | log (T tolerance=T(SYS_FTOLERANCE), int max_iterations=10) |
Compute the log of A using Taylor approximation. More... | |
UT_Matrix4T< T > & | sqrt (T tolerance=T(SYS_FTOLERANCE), int max_iterations=10) |
Compute the square root of A. More... | |
int | save (std::ostream &os, int binary) const |
bool | load (UT_IStream &is) |
void | dump (const char *msg="") const |
void | outAsciiNoName (std::ostream &os) const |
void | perspective (fpreal zoom, fpreal image_aspect, fpreal pixel_aspect=1, fpreal clip_near=0, fpreal clip_far=1, fpreal window_xmin=0, fpreal window_xmax=1, fpreal window_ymin=0, fpreal window_ymax=1) |
void | orthographic (fpreal zoom, fpreal orthowidth, fpreal image_aspect, fpreal pixel_aspect=1, fpreal clip_near=0, fpreal clip_far=1, fpreal window_xmin=0, fpreal window_xmax=1, fpreal window_ymin=0, fpreal window_ymax=1) |
template<int ORDER> | |
void | rotate (T rx, T ry, T rz) |
template<typename S > | |
UT_Matrix4T< T > & | operator= (const UT_Matrix3T< S > &m) |
void | leftMult (const UT_Matrix4T< T > &m) |
void | preMultiply (const UT_Matrix4T< T > &m) |
int | invert (T tol=0.0F) |
int | invertDouble () |
int | invert (UT_Matrix4T< T > &m) const |
int | invertDouble (UT_Matrix4T< T > &m) const |
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 | rotate (T rx, T ry, T rz, const UT_XformOrder &ord) |
SYS_FORCE_INLINE void | rotate (const UT_Vector3T< T > &rad, const UT_XformOrder &ord) |
void | prerotate (T rx, T ry, T rz, const UT_XformOrder &ord) |
SYS_FORCE_INLINE void | prerotate (const UT_Vector3T< T > &rad, const UT_XformOrder &ord) |
void | scale (T sx, T sy, T sz, T sw=1) |
SYS_FORCE_INLINE void | scale (const UT_Vector3T< T > &s) |
SYS_FORCE_INLINE void | scale (T s) |
void | prescale (T sx, T sy, T sz, T sw=1) |
SYS_FORCE_INLINE void | prescale (const UT_Vector3T< T > &s) |
SYS_FORCE_INLINE void | prescale (T s) |
void | shear (T s_xy, T s_xz, T s_yz) |
SYS_FORCE_INLINE void | shear (const UT_Vector3T< T > &sh) |
void | translate (T dx, T dy, T dz=0) |
SYS_FORCE_INLINE void | translate (const UT_Vector3T< T > &delta) |
void | pretranslate (T dx, T dy, T dz=0) |
SYS_FORCE_INLINE void | pretranslate (const UT_Vector3T< T > &delta) |
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) |
Return a matrix entry. No bounds checking on subscripts. More... | |
SYS_FORCE_INLINE T | operator() (unsigned row, unsigned col) const |
Return a matrix entry. No bounds checking on subscripts. More... | |
SYS_FORCE_INLINE T * | operator() (unsigned row) |
Return a matrix row. No bounds checking on subscript. More... | |
SYS_FORCE_INLINE const T * | operator() (unsigned row) const |
Return a matrix row. No bounds checking on subscript. More... | |
const UT_Vector4T< T > & | operator[] (unsigned row) const |
Return a matrix row. No bounds checking on subscript. More... | |
UT_Vector4T< 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_Matrix4T< T > & | getIdentityMatrix () |
static int | entries () |
Returns the vector size. More... | |
template<typename S > | |
static UT_Matrix4T< T > | rotationMat (UT_Vector3T< S > &axis, T theta, int norm=1) |
static UT_Matrix4T< T > | rotationMat (UT_Axis3::axis a, T theta) |
template<typename S > | |
static UT_Matrix4T< T > | reflectMat (const UT_Vector3T< S > &plane_origin, const UT_Vector3T< S > &plane_normal) |
Public Attributes | |
union { | |
T matx [4][4] | |
T myFloats [tuple_size] | |
}; | |
Static Public Attributes | |
static constexpr const int | tuple_size = 16 |
Friends | |
std::ostream & | operator<< (std::ostream &os, const UT_Matrix4T< T > &v) |
This class implements a 4x4 fpreal matrix in row-major order.
Most of Houdini operates with row vectors that are left-multiplied with matrices. e.g., z = v * M As a result, translation data is in row 3 of the matrix, rather than column 3.
Definition at line 96 of file UT_Matrix4.h.
typedef PivotSpaceT<T> UT_Matrix4T< T >::PivotSpace |
Definition at line 862 of file UT_Matrix4.h.
typedef T UT_Matrix4T< T >::value_type |
Definition at line 100 of file UT_Matrix4.h.
enum UT_Matrix4T::applyType |
Enumerator | |
---|---|
BEFORE | |
EQUAL | |
AFTER | |
BEFORE_EQUAL | |
AFTER_EQUAL |
Definition at line 930 of file UT_Matrix4.h.
|
default |
Construct uninitialized matrix.
|
default |
Default copy constructor.
|
default |
Default move constructor.
|
inlineexplicitnoexcept |
Construct identity matrix, multipled by scalar.
Definition at line 113 of file UT_Matrix4.h.
|
inlineexplicit |
Definition at line 169 of file UT_Matrix4.h.
|
inline |
Definition at line 178 of file UT_Matrix4.h.
void UT_Matrix4T< 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 358 of file UT_Matrix4.h.
void UT_Matrix4T< T >::compose | ( | const UT_XformOrder & | order, |
UT_Vector3T< S > & | trn, | ||
UT_Vector3T< S > & | rot, | ||
UT_Matrix3T< T > & | stretch | ||
) |
Composes a transform matrix given the translation, rotation (in radians), and stretch matrix components. This is the inverse of the decompose method.
|
inline |
Return the raw matrix data.
Definition at line 1163 of file UT_Matrix4.h.
|
inline |
Return the raw matrix data.
Definition at line 1164 of file UT_Matrix4.h.
bool UT_Matrix4T< T >::decompose | ( | const UT_XformOrder & | order, |
UT_Vector3T< S > & | trn, | ||
UT_Vector3T< S > & | rot, | ||
UT_Matrix3T< T > & | stretch, | ||
const int | max_iter = 64 , |
||
const T | rel_tol = FLT_EPSILON |
||
) | const |
Extract the translate, rotation (in radians), and stretch components of the 4x4 matrix, preferably using polar decomposition. This method is slower than alternatives (explode, crack), but provides better results for animation.
|
inline |
Definition at line 383 of file UT_Matrix4.h.
|
inline |
Compute determinant of the upper-left 3x3 sub-matrix.
Definition at line 391 of file UT_Matrix4.h.
bool UT_Matrix4T< T >::diagonalizeSymmetric | ( | UT_Matrix4T< T > & | R, |
UT_Matrix4T< T > & | D, | ||
T | tol = 1e-6f , |
||
int | maxiter = 100 |
||
) | const |
|
inline |
Definition at line 1087 of file UT_Matrix4.h.
T UT_Matrix4T< T >::dot | ( | const UT_Matrix4T< T > & | m | ) | const |
Dot product with another matrix Does dot(a,b) = sum_ij a_ij * b_ij
void UT_Matrix4T< T >::dump | ( | const char * | msg = "" | ) | const |
|
inlinestatic |
Returns the vector size.
Definition at line 1272 of file UT_Matrix4.h.
UT_Matrix4T<T>& UT_Matrix4T< T >::exp | ( | int | q | ) |
Compute the exponential of A using Pade approximants with scaling and squaring by q.
|
inline |
Definition at line 958 of file UT_Matrix4.h.
|
inline |
Definition at line 962 of file UT_Matrix4.h.
|
inline |
Definition at line 973 of file UT_Matrix4.h.
|
inline |
Definition at line 978 of file UT_Matrix4.h.
|
inline |
Definition at line 990 of file UT_Matrix4.h.
|
inline |
Definition at line 995 of file UT_Matrix4.h.
int UT_Matrix4T< T >::explode2D | ( | const UT_XformOrder & | order, |
S & | r, | ||
UT_Vector2T< S > & | s, | ||
UT_Vector2T< S > & | t, | ||
S * | shears = 0 |
||
) | const |
int UT_Matrix4T< T >::explode2D | ( | const UT_XformOrder & | order, |
S & | r, | ||
UT_Vector2T< S > & | s, | ||
UT_Vector2T< S > & | t, | ||
const UT_Vector2T< S > & | p, | ||
S * | shears = 0 |
||
) | const |
int UT_Matrix4T< T >::explodeT | ( | const UT_XformOrder & | order, |
UT_Vector3T< S > & | r, | ||
UT_Vector3T< S > & | s, | ||
UT_Vector3T< S > & | t, | ||
UT_Vector3T< S > * | shears | ||
) | const |
int UT_Matrix4T< T >::explodeT | ( | const UT_XformOrder & | order, |
UT_Vector3T< S > & | r, | ||
UT_Vector3T< S > & | s, | ||
UT_Vector3T< S > & | t, | ||
const UT_Vector3T< S > & | p, | ||
UT_Vector3T< S > * | shears | ||
) | const |
int UT_Matrix4T< T >::explodeT | ( | const UT_XformOrder & | order, |
UT_Vector3T< S > & | r, | ||
UT_Vector3T< S > & | s, | ||
UT_Vector3T< S > & | t, | ||
const PivotSpaceT< S > & | p, | ||
UT_Vector3T< S > * | shears | ||
) | const |
void UT_Matrix4T< T >::extractRotate | ( | UT_Matrix3T< S > & | dst | ) | const |
WARNING: This may not produce good results! Instead, get the UT_Matrix3 part and call UT_Matrix3T::makeRotationMatrix().
|
inline |
Euclidean or Frobenius norm of a matrix. Does sqrt(sum(a_ij ^2))
Definition at line 1212 of file UT_Matrix4.h.
T UT_Matrix4T< T >::getEuclideanNorm2 | ( | ) | const |
Euclidean norm squared.
|
static |
|
inline |
L-Infinity Norm, but using col vector convention.
Definition at line 1235 of file UT_Matrix4.h.
T UT_Matrix4T< 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_Matrix4T< 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_Matrix4T< 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_Matrix4T< T >::getNormSpectral | ( | ) | const |
Get the spectral norm of this matrix Returns the maximum singular value.
|
inline |
Definition at line 1432 of file UT_Matrix4.h.
|
inline |
Compute a hash.
Definition at line 1168 of file UT_Matrix4.h.
|
inline |
Set the matrix to identity.
Definition at line 1128 of file UT_Matrix4.h.
|
inline |
Definition at line 476 of file UT_Matrix4.h.
|
inline |
Definition at line 482 of file UT_Matrix4.h.
|
inline |
Definition at line 495 of file UT_Matrix4.h.
|
inline |
Definition at line 501 of file UT_Matrix4.h.
void UT_Matrix4T< T >::instanceInverseT | ( | const UT_Vector3T< S > & | p, |
const UT_Vector3T< S > & | v, | ||
T | s, | ||
const UT_Vector3T< S > * | s3, | ||
const UT_Vector3T< S > * | up, | ||
const UT_QuaternionT< S > * | q, | ||
const UT_Vector3T< S > * | tr, | ||
const UT_QuaternionT< S > * | orient, | ||
const UT_Vector3T< S > * | pivot | ||
) |
void UT_Matrix4T< T >::instanceT | ( | const UT_Vector3T< S > & | p, |
const UT_Vector3T< S > & | v, | ||
T | s, | ||
const UT_Vector3T< S > * | s3, | ||
const UT_Vector3T< S > * | up, | ||
const UT_QuaternionT< S > * | q, | ||
const UT_Vector3T< S > * | tr, | ||
const UT_QuaternionT< S > * | orient, | ||
const UT_Vector3T< S > * | pivot | ||
) |
int UT_Matrix4T< T >::invert | ( | T | tol = 0.0F | ) |
Invert this matrix and return 0 if OK, 1 if singular. If singular, the matrix will be in an undefined state.
int UT_Matrix4T< T >::invert | ( | UT_Matrix4T< 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_Matrix4T< T >::invertDouble | ( | ) |
Invert this matrix and return 0 if OK, 1 if singular. If singular, the matrix will be in an undefined state.
int UT_Matrix4T< T >::invertDouble | ( | UT_Matrix4T< 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_Matrix4T< T >::invertKramer | ( | ) |
int UT_Matrix4T< T >::invertKramer | ( | UT_Matrix4T< T > & | m | ) | const |
|
inline |
Definition at line 528 of file UT_Matrix4.h.
|
inline |
Definition at line 1132 of file UT_Matrix4.h.
bool UT_Matrix4T< T >::isSymmetric | ( | T | tolerance = T(SYS_FTOLERANCE) | ) | const |
|
inline |
Definition at line 1146 of file UT_Matrix4.h.
|
inline |
Multiply the passed-in matrix (on the left) by this (on the right) and assign the result to this. (operator*= does right-multiplication)
Definition at line 1593 of file UT_Matrix4.h.
|
inline |
Definition at line 1114 of file UT_Matrix4.h.
bool UT_Matrix4T< T >::load | ( | UT_IStream & | is | ) |
bool UT_Matrix4T< T >::load | ( | UT_JSONParser & | p | ) |
Methods to serialize to a JSON stream. The matrix is stored as an array of 16 reals.
UT_Matrix4T<T>& UT_Matrix4T< T >::log | ( | T | tolerance = T(SYS_FTOLERANCE) , |
int | max_iterations = 10 |
||
) |
Compute the log of A using Taylor approximation.
bool UT_Matrix4T< T >::makeRigidMatrix | ( | 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" rigid transformation (only rotations and translations) matrix.
It uses polarDecompose and then negates the matrix 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 matrix4 into a rotation and translation matrix. If that ever changes, put a warning here, and you may want to update UT_Matrix3::makeRotationMatrix too.
|
inline |
Definition at line 297 of file UT_Matrix4.h.
|
inline |
Return a matrix entry. No bounds checking on subscripts.
Definition at line 1173 of file UT_Matrix4.h.
|
inline |
Return a matrix entry. No bounds checking on subscripts.
Definition at line 1179 of file UT_Matrix4.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 1189 of file UT_Matrix4.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 1195 of file UT_Matrix4.h.
|
inline |
Definition at line 1468 of file UT_Matrix4.h.
|
inline |
Definition at line 1527 of file UT_Matrix4.h.
|
inline |
NOTE: DO NOT use this for scaling the transform, since this scales the w column (3) as well, causing problems with translation later. Use M.scale(scalar) instead.
Definition at line 316 of file UT_Matrix4.h.
|
inline |
Definition at line 243 of file UT_Matrix4.h.
|
inline |
Definition at line 1404 of file UT_Matrix4.h.
|
inline |
Definition at line 233 of file UT_Matrix4.h.
|
inline |
Definition at line 259 of file UT_Matrix4.h.
|
inline |
Definition at line 1418 of file UT_Matrix4.h.
|
inline |
Definition at line 332 of file UT_Matrix4.h.
|
default |
Default copy assignment operator.
|
default |
Default move assignment operator.
|
inline |
Conversion operator that expands a 3x3 into a 4x4 matrix by adding a row and column of zeroes, except the diagonal element which is 1.
Definition at line 193 of file UT_Matrix4.h.
|
inline |
Definition at line 207 of file UT_Matrix4.h.
|
inline |
Conversion from a symmetric to a non symmetric matrix.
Definition at line 222 of file UT_Matrix4.h.
|
inline |
Definition at line 303 of file UT_Matrix4.h.
|
inline |
Definition at line 1392 of file UT_Matrix4.h.
|
inline |
Definition at line 281 of file UT_Matrix4.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 1451 of file UT_Matrix4.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 1459 of file UT_Matrix4.h.
void UT_Matrix4T< T >::orthographic | ( | fpreal | zoom, |
fpreal | orthowidth, | ||
fpreal | image_aspect, | ||
fpreal | pixel_aspect = 1 , |
||
fpreal | clip_near = 0 , |
||
fpreal | clip_far = 1 , |
||
fpreal | window_xmin = 0 , |
||
fpreal | window_xmax = 1 , |
||
fpreal | window_ymin = 0 , |
||
fpreal | window_ymax = 1 |
||
) |
Create an orthographic projection matrix with the given parameters. This can be used to project points onto the so-called NDC coordinates of a camera. For example, given a point P
(in the space of a camera):
zoom
orthowidth
image_aspect
pixel_aspect
near
,far window
The projection transform will transform the z coordinate of the camera space point such that the near coordinate will map to 0 and the far coordinate will map to 1. That is n dz.z = fit(P.z, near, far, 0, 1);
. Thus, if the near/far are set to 0/1, the NDC z-coordinate will be the same as the camera space z. If the near/far are set to 0/-1, the Z coordinate will be negated.
zoom
is expressed in terms of focal
and aperture
. In this case: zoom = focal/aperture
image_aspect
is expressed in terms of xrex
and yres
. In this case: image_aspect = xres / yres
worldToNDC = worldToCamera * projection;
void UT_Matrix4T< T >::outAsciiNoName | ( | std::ostream & | os | ) | const |
void UT_Matrix4T< T >::outerproductUpdate | ( | T | b, |
const UT_Vector4T< S > & | v1, | ||
const UT_Vector4T< S > & | v2 | ||
) |
void UT_Matrix4T< T >::perspective | ( | fpreal | zoom, |
fpreal | image_aspect, | ||
fpreal | pixel_aspect = 1 , |
||
fpreal | clip_near = 0 , |
||
fpreal | clip_far = 1 , |
||
fpreal | window_xmin = 0 , |
||
fpreal | window_xmax = 1 , |
||
fpreal | window_ymin = 0 , |
||
fpreal | window_ymax = 1 |
||
) |
Create a perspective projection matrix with the given parameters. This can be used to project points onto the so-called NDC coordinates of a camera. For example, given a point P
(in the space of a camera):
zoom
image_aspect
pixel_aspect
near
,far window
The projection transform will transform the z coordinate of the camera space point such that the near coordinate will map to 0 and the far coordinate will map to 1. That is n dz.z = fit(P.z, near, far, 0, 1);
. Thus, if the near/far are set to 0/1, the NDC z-coordinate will be the same as the camera space z. If the near/far are set to 0/-1, the Z coordinate will be negated.
zoom
is expressed in terms of focal
and aperture
. In this case: zoom = focal/aperture
image_aspect
is expressed in terms of xres
and yres
. In this case: image_aspect = xres / yres
worldToNDC = worldToCamera * projection;
bool UT_Matrix4T< 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 of the 3x3 matrix M into an orthogonal matrix Q and an symmetric positive-semidefinite matrix S. This is more useful than explode() or extractRotate() 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.
This method is similar to the UT_Matrix3 version except it only operates on the upper-right 3x3 portion.
|
inline |
Multiply the passed-in matrix (on the left) by this (on the right) and assign the result to this. (operator*= does right-multiplication)
Definition at line 352 of file UT_Matrix4.h.
void UT_Matrix4T< T >::prerotate | ( | UT_Vector3T< S > & | axis, |
T | theta, | ||
int | norm = 1 |
||
) |
Pre-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_Matrix4T< T >::prerotate | ( | UT_Axis3::axis | a, |
T | theta | ||
) |
Pre-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.
Pre-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_Matrix4T< T >::prerotate | ( | T | rx, |
T | ry, | ||
T | rz, | ||
const UT_XformOrder & | ord | ||
) |
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 695 of file UT_Matrix4.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 669 of file UT_Matrix4.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 643 of file UT_Matrix4.h.
Pre-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 723 of file UT_Matrix4.h.
|
inline |
Pre-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 737 of file UT_Matrix4.h.
|
inline |
Pre-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 739 of file UT_Matrix4.h.
Pre-multiply this matrix by the translation determined by dx, dy, dz.
Definition at line 792 of file UT_Matrix4.h.
|
inline |
Pre-multiply this matrix by the translation determined by dx, dy, dz.
Definition at line 800 of file UT_Matrix4.h.
|
inlinestatic |
Create a reflection matrix for the given normal to the mirror plane.
Definition at line 1102 of file UT_Matrix4.h.
void UT_Matrix4T< 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_Matrix4T< 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_Matrix4T< 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 685 of file UT_Matrix4.h.
void UT_Matrix4T< T >::rotate | ( | const UT_XformOrder & | order, |
applyType | type, | ||
char | limit, | ||
T | rx, | ||
T | ry, | ||
T | rz | ||
) |
Post-rotate by rx, ry, rz radians around the three basic axes in the order given by a templated UT_XformOrder.
Definition at line 2256 of file UT_Matrix4.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 592 of file UT_Matrix4.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 569 of file UT_Matrix4.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 607 of file UT_Matrix4.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_Matrix4T< T >::save | ( | std::ostream & | os, |
int | binary | ||
) | const |
bool UT_Matrix4T< T >::save | ( | UT_JSONWriter & | w | ) | const |
Methods to serialize to a JSON stream. The matrix is stored as an array of 16 reals.
bool UT_Matrix4T< T >::save | ( | UT_JSONValue & | v | ) | const |
Methods to serialize to a JSON stream. The matrix is stored as an array of 16 reals.
Post-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 701 of file UT_Matrix4.h.
|
inline |
Post-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 715 of file UT_Matrix4.h.
|
inline |
Post-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)
Definition at line 717 of file UT_Matrix4.h.
|
inline |
Definition at line 1442 of file UT_Matrix4.h.
Post-multiply this matrix by the shear matrix formed by (sxy, sxz, syz) where the shear matrix is:
Definition at line 752 of file UT_Matrix4.h.
|
inline |
Post-multiply this matrix by the shear matrix formed by (sxy, sxz, syz) where the shear matrix is:
Definition at line 767 of file UT_Matrix4.h.
int UT_Matrix4T< T >::solve | ( | const UT_Vector4T< S > & | b, |
UT_Vector4T< S > & | x | ||
) | const |
int UT_Matrix4T< T >::solveTranspose | ( | const UT_Vector4T< S > & | b, |
UT_Vector4T< S > & | x | ||
) | const |
UT_Matrix4T<T>& UT_Matrix4T< T >::sqrt | ( | T | tolerance = T(SYS_FTOLERANCE) , |
int | max_iterations = 10 |
||
) |
Compute the square root of A.
void UT_Matrix4T< T >::stretch | ( | UT_Vector3T< S > & | v, |
T | amount, | ||
int | norm = 1 |
||
) |
void UT_Matrix4T< T >::svdDecomposition | ( | UT_Matrix4T< T > & | U, |
UT_Matrix4T< T > & | S, | ||
UT_Matrix4T< T > & | V, | ||
T | tol = 1e-6f |
||
) | const |
|
inline |
Definition at line 401 of file UT_Matrix4.h.
Post-multiply this matrix by the translation determined by dx, dy, dz.
Definition at line 773 of file UT_Matrix4.h.
|
inline |
Post-multiply this matrix by the translation determined by dx, dy, dz.
Definition at line 786 of file UT_Matrix4.h.
|
inline |
Definition at line 509 of file UT_Matrix4.h.
|
inline |
Definition at line 519 of file UT_Matrix4.h.
void UT_Matrix4T< T >::xform | ( | const UT_XformOrder & | order, |
T | tx = 0 , |
||
T | ty = 0 , |
||
T | tz = 0 , |
||
T | rx = 0 , |
||
T | ry = 0 , |
||
T | rz = 0 , |
||
T | sx = 1 , |
||
T | sy = 1 , |
||
T | sz = 1 , |
||
T | px = 0 , |
||
T | py = 0 , |
||
T | pz = 0 , |
||
int | reverse = 0 |
||
) |
void UT_Matrix4T< T >::xform | ( | const UT_XformOrder & | order, |
T | tx, | ||
T | ty, | ||
T | tz, | ||
T | rx, | ||
T | ry, | ||
T | rz, | ||
T | sx, | ||
T | sy, | ||
T | sz, | ||
T | s_xy, | ||
T | s_xz, | ||
T | s_yz, | ||
T | px, | ||
T | py, | ||
T | pz, | ||
int | reverse = 0 |
||
) |
void UT_Matrix4T< T >::xform | ( | const UT_XformOrder & | order, |
T | tx, | ||
T | ty, | ||
T | tz, | ||
T | rx, | ||
T | ry, | ||
T | rz, | ||
T | sx, | ||
T | sy, | ||
T | sz, | ||
const PivotSpace & | pivot, | ||
int | reverse = 0 |
||
) |
void UT_Matrix4T< T >::xform | ( | const UT_XformOrder & | order, |
T | tx, | ||
T | ty, | ||
T | tz, | ||
T | rx, | ||
T | ry, | ||
T | rz, | ||
T | sx, | ||
T | sy, | ||
T | sz, | ||
T | s_xy, | ||
T | s_xz, | ||
T | s_yz, | ||
const PivotSpace & | pivot, | ||
int | reverse = 0 |
||
) |
void UT_Matrix4T< T >::xform | ( | const FullTransformModel & | parms, |
T | min_abs_scale = T(0) |
||
) |
void UT_Matrix4T< T >::xform | ( | const UT_XformOrder & | order, |
applyType | type, | ||
char | limit, | ||
T | tx, | ||
T | ty, | ||
T | tz, | ||
T | rx, | ||
T | ry, | ||
T | rz, | ||
T | sx, | ||
T | sy, | ||
T | sz, | ||
T | px, | ||
T | py, | ||
T | pz | ||
) |
|
inline |
Set the matrix to zero.
Definition at line 1130 of file UT_Matrix4.h.
|
friend |
Definition at line 1264 of file UT_Matrix4.h.
union { ... } |
T UT_Matrix4T< T >::matx[4][4] |
Definition at line 1277 of file UT_Matrix4.h.
T UT_Matrix4T< T >::myFloats[tuple_size] |
Definition at line 1278 of file UT_Matrix4.h.
|
static |
Definition at line 101 of file UT_Matrix4.h.