HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Matrix4T< T > Class Template Reference

#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< TPivotSpace
 

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...
 
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< Toperator- () 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< Ttranspose () 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 Tdata () const
 Return the raw matrix data. More...
 
Tdata ()
 Return the raw matrix data. More...
 
SYS_FORCE_INLINE Toperator() (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 Toperator() (unsigned row)
 Return a matrix row. No bounds checking on subscript. More...
 
SYS_FORCE_INLINE const Toperator() (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< TrotationMat (UT_Vector3T< S > &axis, T theta, int norm=1)
 
static UT_Matrix4T< TrotationMat (UT_Axis3::axis a, T theta)
 
template<typename S >
static UT_Matrix4T< TreflectMat (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)
 

Detailed Description

template<typename T>
class UT_Matrix4T< T >

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.

Member Typedef Documentation

template<typename T>
typedef PivotSpaceT<T> UT_Matrix4T< T >::PivotSpace

Definition at line 862 of file UT_Matrix4.h.

template<typename T>
typedef T UT_Matrix4T< T >::value_type

Definition at line 100 of file UT_Matrix4.h.

Member Enumeration Documentation

template<typename T>
enum UT_Matrix4T::applyType
Enumerator
BEFORE 
EQUAL 
AFTER 
BEFORE_EQUAL 
AFTER_EQUAL 

Definition at line 930 of file UT_Matrix4.h.

Constructor & Destructor Documentation

template<typename T>
SYS_FORCE_INLINE UT_Matrix4T< T >::UT_Matrix4T ( )
default

Construct uninitialized matrix.

template<typename T>
constexpr UT_Matrix4T< T >::UT_Matrix4T ( const UT_Matrix4T< T > &  )
default

Default copy constructor.

template<typename T>
constexpr UT_Matrix4T< T >::UT_Matrix4T ( UT_Matrix4T< T > &&  )
default

Default move constructor.

template<typename T>
constexpr UT_Matrix4T< T >::UT_Matrix4T ( fpreal64  val)
inlineexplicitnoexcept

Construct identity matrix, multipled by scalar.

Definition at line 113 of file UT_Matrix4.h.

template<typename T>
U UT_Matrix4T< T >::UT_Matrix4T ( const UT_Matrix3T< S > &  m,
const UT_Vector3T< U > &  t 
)
inlineexplicit

Definition at line 169 of file UT_Matrix4.h.

template<typename T>
template<typename S >
UT_Matrix4T< T >::UT_Matrix4T ( const UT_SymMatrix4T< S > &  m)
inline

Definition at line 178 of file UT_Matrix4.h.

Member Function Documentation

template<typename T>
template<typename S >
void UT_Matrix4T< T >::changeSpace ( UT_Vector3T< S > &  iSrc,
UT_Vector3T< S > &  jSrc,
UT_Vector3T< S > &  iDest,
UT_Vector3T< S > &  jDest,
int  norm = 1 
)
template<typename T>
SYS_FORCE_INLINE T UT_Matrix4T< T >::coFactor ( int  k,
int  l 
) const
inline

Definition at line 358 of file UT_Matrix4.h.

template<typename T>
template<typename S >
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.

template<typename T>
const T* UT_Matrix4T< T >::data ( ) const
inline

Return the raw matrix data.

Definition at line 1163 of file UT_Matrix4.h.

template<typename T>
T* UT_Matrix4T< T >::data ( )
inline

Return the raw matrix data.

Definition at line 1164 of file UT_Matrix4.h.

template<typename T>
template<typename S >
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.

Returns
true if the polar decomposition succeeded, false otherwise Regardless of the return value, sensible values for translation rotation and stretch are computed.
template<typename T>
T UT_Matrix4T< T >::determinant ( ) const
inline

Definition at line 383 of file UT_Matrix4.h.

template<typename T>
T UT_Matrix4T< T >::determinant3 ( ) const
inline

Compute determinant of the upper-left 3x3 sub-matrix.

Definition at line 391 of file UT_Matrix4.h.

template<typename T>
bool UT_Matrix4T< T >::diagonalizeSymmetric ( UT_Matrix4T< T > &  R,
UT_Matrix4T< T > &  D,
T  tol = 1e-6f,
int  maxiter = 100 
) const
template<typename T>
T UT_Matrix4T< T >::dot ( unsigned  i,
unsigned  j 
) const
inline

Definition at line 1087 of file UT_Matrix4.h.

template<typename T>
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

template<typename T>
void UT_Matrix4T< T >::dump ( const char *  msg = "") const
template<typename T>
static int UT_Matrix4T< T >::entries ( )
inlinestatic

Returns the vector size.

Definition at line 1272 of file UT_Matrix4.h.

template<typename T>
UT_Matrix4T<T>& UT_Matrix4T< T >::exp ( int  q)

Compute the exponential of A using Pade approximants with scaling and squaring by q.

template<typename T>
int UT_Matrix4T< T >::explode ( const UT_XformOrder order,
UT_Vector3F r,
UT_Vector3F s,
UT_Vector3F t,
UT_Vector3F shears = 0 
) const
inline

Definition at line 958 of file UT_Matrix4.h.

template<typename T>
int UT_Matrix4T< T >::explode ( const UT_XformOrder order,
UT_Vector3D r,
UT_Vector3D s,
UT_Vector3D t,
UT_Vector3D shears = 0 
) const
inline

Definition at line 962 of file UT_Matrix4.h.

template<typename T>
int UT_Matrix4T< T >::explode ( const UT_XformOrder order,
UT_Vector3F r,
UT_Vector3F s,
UT_Vector3F t,
const UT_Vector3F p,
UT_Vector3F shears = 0 
) const
inline

Definition at line 973 of file UT_Matrix4.h.

template<typename T>
int UT_Matrix4T< T >::explode ( const UT_XformOrder order,
UT_Vector3D r,
UT_Vector3D s,
UT_Vector3D t,
const UT_Vector3D p,
UT_Vector3D shears = 0 
) const
inline

Definition at line 978 of file UT_Matrix4.h.

template<typename T>
int UT_Matrix4T< T >::explode ( const UT_XformOrder order,
UT_Vector3F r,
UT_Vector3F s,
UT_Vector3F t,
const PivotSpaceT< fpreal32 > &  p,
UT_Vector3F shears = 0 
) const
inline

Definition at line 990 of file UT_Matrix4.h.

template<typename T>
int UT_Matrix4T< T >::explode ( const UT_XformOrder order,
UT_Vector3D r,
UT_Vector3D s,
UT_Vector3D t,
const PivotSpaceT< fpreal64 > &  p,
UT_Vector3D shears = 0 
) const
inline

Definition at line 995 of file UT_Matrix4.h.

template<typename T>
template<typename S >
int UT_Matrix4T< T >::explode2D ( const UT_XformOrder order,
S r,
UT_Vector2T< S > &  s,
UT_Vector2T< S > &  t,
S shears = 0 
) const
template<typename T>
template<typename S >
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
template<typename T>
template<typename S >
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
template<typename T>
template<typename S >
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
template<typename T>
template<typename S >
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
template<typename T>
template<typename S >
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().

template<typename T>
T UT_Matrix4T< T >::getEuclideanNorm ( ) const
inline

Euclidean or Frobenius norm of a matrix. Does sqrt(sum(a_ij ^2))

Definition at line 1212 of file UT_Matrix4.h.

template<typename T>
T UT_Matrix4T< T >::getEuclideanNorm2 ( ) const

Euclidean norm squared.

template<typename T>
static const UT_Matrix4T<T>& UT_Matrix4T< T >::getIdentityMatrix ( )
static
template<typename T>
T UT_Matrix4T< T >::getInfinityNorm ( ) const
inline

L-Infinity Norm, but using col vector convention.

Definition at line 1235 of file UT_Matrix4.h.

template<typename T>
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)))

template<typename T>
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)))

template<typename T>
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)))

template<typename T>
T UT_Matrix4T< T >::getNormSpectral ( ) const

Get the spectral norm of this matrix Returns the maximum singular value.

template<typename T >
template<typename S >
void UT_Matrix4T< T >::getTranslates ( UT_Vector3T< S > &  translates) const
inline

Definition at line 1432 of file UT_Matrix4.h.

template<typename T>
unsigned UT_Matrix4T< T >::hash ( void  ) const
inline

Compute a hash.

Definition at line 1168 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::identity ( )
inline

Set the matrix to identity.

Definition at line 1128 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::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 
)
inline

Definition at line 476 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::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 
)
inline

Definition at line 482 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::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 
)
inline

Definition at line 495 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::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 
)
inline

Definition at line 501 of file UT_Matrix4.h.

template<typename T>
template<typename S >
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 
)
template<typename T>
template<typename S >
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 
)
template<typename T>
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.

template<typename T>
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.

template<typename T>
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.

template<typename T>
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.

template<typename T>
int UT_Matrix4T< T >::invertKramer ( )
template<typename T>
int UT_Matrix4T< T >::invertKramer ( UT_Matrix4T< T > &  m) const
template<typename T>
bool UT_Matrix4T< T >::isEqual ( const UT_Matrix4T< T > &  m,
T  tolerance = T(SYS_FTOLERANCE) 
) const
inline

Definition at line 528 of file UT_Matrix4.h.

template<typename T>
bool UT_Matrix4T< T >::isIdentity ( ) const
inline

Definition at line 1132 of file UT_Matrix4.h.

template<typename T>
bool UT_Matrix4T< T >::isSymmetric ( T  tolerance = T(SYS_FTOLERANCE)) const
template<typename T>
bool UT_Matrix4T< T >::isZero ( ) const
inline

Definition at line 1146 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::leftMult ( const UT_Matrix4T< T > &  m)
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.

template<typename T>
void UT_Matrix4T< T >::lerp ( const UT_Matrix4T< T > &  a,
const UT_Matrix4T< T > &  b,
T  t 
)
inline

Definition at line 1114 of file UT_Matrix4.h.

template<typename T>
bool UT_Matrix4T< T >::load ( UT_IStream is)
template<typename T>
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.

template<typename T>
UT_Matrix4T<T>& UT_Matrix4T< T >::log ( T  tolerance = T(SYS_FTOLERANCE),
int  max_iterations = 10 
)

Compute the log of A using Taylor approximation.

template<typename T>
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.

template<typename T>
bool UT_Matrix4T< T >::operator!= ( const UT_Matrix4T< T > &  m) const
inline

Definition at line 297 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE T& UT_Matrix4T< T >::operator() ( unsigned  row,
unsigned  col 
)
inline

Return a matrix entry. No bounds checking on subscripts.

Definition at line 1173 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE T UT_Matrix4T< T >::operator() ( unsigned  row,
unsigned  col 
) const
inline

Return a matrix entry. No bounds checking on subscripts.

Definition at line 1179 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE T* UT_Matrix4T< T >::operator() ( unsigned  row)
inline

Return a matrix row. No bounds checking on subscript.

Definition at line 1189 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE const T* UT_Matrix4T< T >::operator() ( unsigned  row) const
inline

Return a matrix row. No bounds checking on subscript.

Definition at line 1195 of file UT_Matrix4.h.

template<typename T >
template<typename S >
UT_Matrix4T< T > & UT_Matrix4T< T >::operator*= ( const UT_Matrix4T< S > &  m)
inline

Definition at line 1468 of file UT_Matrix4.h.

template<typename T >
template<typename S >
UT_Matrix4T< T > & UT_Matrix4T< T >::operator*= ( const UT_Matrix3T< S > &  m)
inline

Definition at line 1527 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE UT_Matrix4T<T>& UT_Matrix4T< T >::operator*= ( T  scalar)
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.

template<typename T>
SYS_FORCE_INLINE UT_Matrix4T<T>& UT_Matrix4T< T >::operator+= ( const UT_Matrix4T< T > &  m)
inline

Definition at line 243 of file UT_Matrix4.h.

template<typename T >
template<typename S >
UT_Matrix4T< T > & UT_Matrix4T< T >::operator+= ( const UT_Vector4T< S > &  vec)
inline

Definition at line 1404 of file UT_Matrix4.h.

template<typename T>
UT_Matrix4T<T> UT_Matrix4T< T >::operator- ( ) const
inline

Definition at line 233 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE UT_Matrix4T<T>& UT_Matrix4T< T >::operator-= ( const UT_Matrix4T< T > &  m)
inline

Definition at line 259 of file UT_Matrix4.h.

template<typename T >
template<typename S >
UT_Matrix4T< T > & UT_Matrix4T< T >::operator-= ( const UT_Vector4T< S > &  vec)
inline

Definition at line 1418 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE UT_Matrix4T<T>& UT_Matrix4T< T >::operator/= ( T  scalar)
inline

Definition at line 332 of file UT_Matrix4.h.

template<typename T>
UT_Matrix4T<T>& UT_Matrix4T< T >::operator= ( const UT_Matrix4T< T > &  m)
default

Default copy assignment operator.

template<typename T>
UT_Matrix4T<T>& UT_Matrix4T< T >::operator= ( UT_Matrix4T< T > &&  m)
default

Default move assignment operator.

template<typename T>
template<typename S >
UT_Matrix4T<T>& UT_Matrix4T< T >::operator= ( const UT_Matrix3T< S > &  m)
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.

template<typename T>
template<typename S >
UT_Matrix4T<T>& UT_Matrix4T< T >::operator= ( const UT_Matrix4T< S > &  m)
inline

Definition at line 207 of file UT_Matrix4.h.

template<typename T>
template<typename S >
UT_Matrix4T<T>& UT_Matrix4T< T >::operator= ( const UT_SymMatrix4T< S > &  m)
inline

Conversion from a symmetric to a non symmetric matrix.

Definition at line 222 of file UT_Matrix4.h.

template<typename T>
UT_Matrix4T<T>& UT_Matrix4T< T >::operator= ( fpreal64  v)
inline

Definition at line 303 of file UT_Matrix4.h.

template<typename T >
template<typename S >
UT_Matrix4T< T > & UT_Matrix4T< T >::operator= ( const UT_Vector4T< S > &  vec)
inline

Definition at line 1392 of file UT_Matrix4.h.

template<typename T>
bool UT_Matrix4T< T >::operator== ( const UT_Matrix4T< T > &  m) const
inline

Definition at line 281 of file UT_Matrix4.h.

template<typename T >
const UT_Vector4T< T > & UT_Matrix4T< T >::operator[] ( unsigned  row) const
inline

Return a matrix row. No bounds checking on subscript.

Definition at line 1451 of file UT_Matrix4.h.

template<typename T >
UT_Vector4T< T > & UT_Matrix4T< T >::operator[] ( unsigned  row)
inline

Return a matrix row. No bounds checking on subscript.

Definition at line 1459 of file UT_Matrix4.h.

template<typename T>
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):

proj.orthographic(zoom, 1, image_aspect);
ndc = P * proj;
  • zoom
    The zoom for the lens
  • orthowidth
    An additional "zoom" factor
  • image_aspect
    The resolution of the image
  • pixel_aspect
    The pixel aspect (the aspect ratio of pixels)
  • near,far
    The near/far clipping planes
  • window
    The offset for the projection 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.

Note
Sometimes the zoom is expressed in terms of focal and aperture. In this case: zoom = focal/aperture
Sometimes the image_aspect is expressed in terms of xrex and yres. In this case: image_aspect = xres / yres
To make a single transform from world space to NDC space given a camera matrix and a projection matrix, you would use worldToNDC = worldToCamera * projection;
template<typename T>
void UT_Matrix4T< T >::outAsciiNoName ( std::ostream &  os) const
template<typename T>
template<typename S >
void UT_Matrix4T< T >::outerproductUpdate ( T  b,
const UT_Vector4T< S > &  v1,
const UT_Vector4T< S > &  v2 
)
template<typename T>
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):

proj.perspective(zoom, image_aspect);
ndc = P * proj;
  • zoom
    The zoom for the lens
  • image_aspect
    The aspect ratio of the image
  • pixel_aspect
    The pixel aspect (the aspect ratio of pixels)
  • near,far
    The near/far clipping planes
  • window
    The offset for the projection 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.

Note
Sometimes the zoom is expressed in terms of focal and aperture. In this case: zoom = focal/aperture
Sometimes the image_aspect is expressed in terms of xres and yres. In this case: image_aspect = xres / yres
To make a single transform from world space to NDC space given a camera matrix and a projection matrix, you would use worldToNDC = worldToCamera * projection;
template<typename T>
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.

Precondition
The upper-right 3x3 portion of *this is non-singular
Postcondition
The upper-right 3x3 porition = Q, and if stretch != 0: *stretch = S.
Returns
True if successful
template<typename T>
void UT_Matrix4T< T >::preMultiply ( const UT_Matrix4T< T > &  m)
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.

template<typename T>
template<typename S >
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.

template<typename T>
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.

template<typename T>
template<UT_Axis3::axis A>
void UT_Matrix4T< T >::prerotate ( 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.

template<typename T>
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.

template<typename T>
SYS_FORCE_INLINE void UT_Matrix4T< T >::prerotate ( const UT_Vector3T< T > &  rad,
const UT_XformOrder ord 
)
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.

template<typename T>
template<UT_Axis3::axis A>
SYS_FORCE_INLINE void UT_Matrix4T< T >::prerotateHalf ( )
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.

template<typename T>
template<UT_Axis3::axis A, bool reverse = false>
SYS_FORCE_INLINE void UT_Matrix4T< T >::prerotateQuarter ( )
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.

template<typename T>
void UT_Matrix4T< T >::prescale ( T  sx,
T  sy,
T  sz,
T  sw = 1 
)
inline

Pre-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)

Definition at line 723 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE void UT_Matrix4T< T >::prescale ( const UT_Vector3T< T > &  s)
inline

Pre-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)

Definition at line 737 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE void UT_Matrix4T< T >::prescale ( T  s)
inline

Pre-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)

Definition at line 739 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::pretranslate ( T  dx,
T  dy,
T  dz = 0 
)
inline

Pre-multiply this matrix by the translation determined by dx, dy, dz.

Definition at line 792 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE void UT_Matrix4T< T >::pretranslate ( const UT_Vector3T< T > &  delta)
inline

Pre-multiply this matrix by the translation determined by dx, dy, dz.

Definition at line 800 of file UT_Matrix4.h.

template<typename T>
template<typename S >
static UT_Matrix4T<T> UT_Matrix4T< T >::reflectMat ( const UT_Vector3T< S > &  plane_origin,
const UT_Vector3T< S > &  plane_normal 
)
inlinestatic

Create a reflection matrix for the given normal to the mirror plane.

Definition at line 1102 of file UT_Matrix4.h.

template<typename T>
template<typename S >
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.

template<typename T>
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.

template<typename T>
template<UT_Axis3::axis A>
void UT_Matrix4T< T >::rotate ( 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.

template<typename T>
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.

template<typename T>
SYS_FORCE_INLINE void UT_Matrix4T< T >::rotate ( const UT_Vector3T< T > &  rad,
const UT_XformOrder ord 
)
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.

template<typename T>
void UT_Matrix4T< T >::rotate ( const UT_XformOrder order,
applyType  type,
char  limit,
T  rx,
T  ry,
T  rz 
)
template<typename T>
template<int ORDER>
void UT_Matrix4T< T >::rotate ( 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.

template<typename T>
template<UT_Axis3::axis A>
SYS_FORCE_INLINE void UT_Matrix4T< T >::rotateHalf ( )
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.

template<typename T>
template<UT_Axis3::axis A, bool reverse = false>
SYS_FORCE_INLINE void UT_Matrix4T< T >::rotateQuarter ( )
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.

template<typename T>
template<UT_Axis3::axis A>
SYS_FORCE_INLINE void UT_Matrix4T< T >::rotateWithQTurns ( T  theta,
uint  qturns 
)
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.

template<typename T>
template<typename S >
static UT_Matrix4T<T> UT_Matrix4T< T >::rotationMat ( UT_Vector3T< S > &  axis,
T  theta,
int  norm = 1 
)
static

Create a rotation matrix for the given angle in radians around the axis

template<typename T>
static UT_Matrix4T<T> UT_Matrix4T< T >::rotationMat ( UT_Axis3::axis  a,
T  theta 
)
static

Create a rotation matrix for the given angle in radians around the axis

template<typename T>
int UT_Matrix4T< T >::save ( std::ostream &  os,
int  binary 
) const
template<typename T>
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.

template<typename T>
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.

template<typename T>
void UT_Matrix4T< T >::scale ( T  sx,
T  sy,
T  sz,
T  sw = 1 
)
inline

Post-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)

Definition at line 701 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE void UT_Matrix4T< T >::scale ( const UT_Vector3T< T > &  s)
inline

Post-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)

Definition at line 715 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE void UT_Matrix4T< T >::scale ( T  s)
inline

Post-multiply this matrix by a scale matrix with diagonal (sx, sy, sz)

Definition at line 717 of file UT_Matrix4.h.

template<typename T >
template<typename S >
void UT_Matrix4T< T >::setTranslates ( const UT_Vector3T< S > &  translates)
inline

Definition at line 1442 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::shear ( T  s_xy,
T  s_xz,
T  s_yz 
)
inline

Post-multiply this matrix by the shear matrix formed by (sxy, sxz, syz) where the shear matrix is:

| 1 0 0 0 |
| s_xy 1 0 0 |
| s_xz s_yz 1 0 |
| 0 0 0 1 |

Definition at line 752 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE void UT_Matrix4T< T >::shear ( const UT_Vector3T< T > &  sh)
inline

Post-multiply this matrix by the shear matrix formed by (sxy, sxz, syz) where the shear matrix is:

| 1 0 0 0 |
| s_xy 1 0 0 |
| s_xz s_yz 1 0 |
| 0 0 0 1 |

Definition at line 767 of file UT_Matrix4.h.

template<typename T>
template<typename S >
int UT_Matrix4T< T >::solve ( const UT_Vector4T< S > &  b,
UT_Vector4T< S > &  x 
) const
template<typename T>
template<typename S >
int UT_Matrix4T< T >::solveTranspose ( const UT_Vector4T< S > &  b,
UT_Vector4T< S > &  x 
) const
template<typename T>
UT_Matrix4T<T>& UT_Matrix4T< T >::sqrt ( T  tolerance = T(SYS_FTOLERANCE),
int  max_iterations = 10 
)

Compute the square root of A.

template<typename T>
template<typename S >
void UT_Matrix4T< T >::stretch ( UT_Vector3T< S > &  v,
T  amount,
int  norm = 1 
)
template<typename T>
void UT_Matrix4T< T >::svdDecomposition ( UT_Matrix4T< T > &  U,
UT_Matrix4T< T > &  S,
UT_Matrix4T< T > &  V,
T  tol = 1e-6f 
) const
template<typename T>
T UT_Matrix4T< T >::trace ( ) const
inline

Definition at line 401 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::translate ( T  dx,
T  dy,
T  dz = 0 
)
inline

Post-multiply this matrix by the translation determined by dx, dy, dz.

Definition at line 773 of file UT_Matrix4.h.

template<typename T>
SYS_FORCE_INLINE void UT_Matrix4T< T >::translate ( const UT_Vector3T< T > &  delta)
inline

Post-multiply this matrix by the translation determined by dx, dy, dz.

Definition at line 786 of file UT_Matrix4.h.

template<typename T>
void UT_Matrix4T< T >::transpose ( )
inline

Definition at line 509 of file UT_Matrix4.h.

template<typename T>
UT_Matrix4T<T> UT_Matrix4T< T >::transpose ( ) const
inline

Definition at line 519 of file UT_Matrix4.h.

template<typename T>
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 
)
template<typename T>
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 
)
template<typename T>
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 
)
template<typename T>
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 
)
template<typename T>
void UT_Matrix4T< T >::xform ( const FullTransformModel parms,
T  min_abs_scale = T(0) 
)
template<typename T>
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 
)
template<typename T>
void UT_Matrix4T< T >::zero ( )
inline

Set the matrix to zero.

Definition at line 1130 of file UT_Matrix4.h.

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  os,
const UT_Matrix4T< T > &  v 
)
friend

Definition at line 1264 of file UT_Matrix4.h.

Member Data Documentation

union { ... }
template<typename T>
T UT_Matrix4T< T >::matx[4][4]

Definition at line 1277 of file UT_Matrix4.h.

template<typename T>
T UT_Matrix4T< T >::myFloats[tuple_size]

Definition at line 1278 of file UT_Matrix4.h.

template<typename T>
constexpr const int UT_Matrix4T< T >::tuple_size = 16
static

Definition at line 101 of file UT_Matrix4.h.


The documentation for this class was generated from the following file: