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

#include <UT_Matrix2.h>

Public Types

typedef T value_type
 

Public Member Functions

SYS_FORCE_INLINE UT_Matrix2T ()=default
 Construct uninitialized matrix. More...
 
constexpr UT_Matrix2T (const UT_Matrix2T &)=default
 Default copy constructor. More...
 
constexpr UT_Matrix2T (UT_Matrix2T &&)=default
 Default move constructor. More...
 
constexpr UT_Matrix2T (T val) noexcept
 Construct identity matrix, multipled by scalar. More...
 
 T (0)
 
UT_Matrix2T< T > & operator= (UT_Matrix2T< T > &&m)=default
 Default move assignment operator. More...
 
template<typename S >
UT_Matrix2T< T > & operator= (const UT_Matrix3T< S > &m)
 
UT_Matrix2T< Toperator- () const
 
UT_Matrix2T< T > & operator+= (const UT_Matrix2T< T > &m)
 
UT_Matrix2T< T > & operator-= (const UT_Matrix2T< T > &m)
 
UT_Matrix2T< T > & operator*= (const UT_Matrix2T< T > &m)
 
constexpr bool operator== (const UT_Matrix2T< T > &m) const noexcept
 
constexpr bool operator!= (const UT_Matrix2T< T > &m) const noexcept
 
UT_Matrix2T< T > & operator= (T val)
 
UT_Matrix2T< T > & operator+= (T scalar)
 
UT_Matrix2T< T > & operator-= (T scalar)
 
UT_Matrix2T< T > & operator*= (T scalar)
 
UT_Matrix2T< T > & operator/= (T scalar)
 
template<typename S >
UT_Matrix2T< T > & operator= (const UT_Vector2T< S > &vec)
 
template<typename S >
UT_Matrix2T< T > & operator+= (const UT_Vector2T< S > &vec)
 
template<typename S >
UT_Matrix2T< T > & operator-= (const UT_Vector2T< S > &vec)
 
constexpr T determinant () const noexcept
 
constexpr T trace () const noexcept
 
template<typename S >
int eigenvalues (UT_Vector2T< S > &r, UT_Vector2T< S > &i) const
 Returns eigenvalues of this matrix. More...
 
int invert ()
 Invert this matrix and return 0 if OK, 1 if singular. More...
 
int invert (UT_Matrix2T< T > &m) const
 
T tolerance () const
 Returns the tolerance of our class. More...
 
template<typename S >
int solve (const UT_Vector2T< S > &b, UT_Vector2T< S > &x) const
 
void transpose ()
 
UT_Matrix2T< Ttranspose () const
 
bool isEqual (const UT_Matrix2T< T > &m, T tolerance=T(SYS_FTOLERANCE)) const
 
template<typename S >
void outerproductUpdate (T b, const UT_Vector2T< S > &v1, const UT_Vector2T< S > &v2)
 
void identity ()
 Set the matrix to identity. More...
 
void zero ()
 Set the matrix to zero. More...
 
bool isIdentity () const
 
bool isZero () const
 
void rotate (T theta)
 Rotate by theta radians. More...
 
void initialize ()
 Initialize this matrix to zero. More...
 
unsigned hash () const
 Compute a hash. More...
 
T getEuclideanNorm () const
 
T getEuclideanNorm2 () const
 Euclidean norm squared. More...
 
int save (std::ostream &os, int binary) const
 
bool load (UT_IStream &is)
 
void outAsciiNoName (std::ostream &os) const
 
template<>
int32 tolerance () const
 
template<>
int64 tolerance () const
 
constexpr UT_Matrix2T (const fpreal32 m[2][2]) noexcept
 
void scale (T sx, T sy)
 
void scale (const UT_Vector2T< T > &s)
 
SYS_FORCE_INLINE Toperator() (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...
 
const Tdata () const
 Return the raw matrix data. More...
 
Tdata ()
 Return the raw matrix data. More...
 
Toperator() (unsigned row)
 Return a matrix row. No bounds checking on subscript. More...
 
const Toperator() (unsigned row) const
 Return a matrix row. No bounds checking on subscript. More...
 
const UT_Vector2T< T > & operator[] (unsigned row) const
 Return a matrix row. No bounds checking on subscript. More...
 
UT_Vector2T< 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 UT_Matrix2T< TrotationMat (T theta)
 Create a rotation matrix for the given angle in radians. More...
 
static int entries ()
 Returns the vector size. More...
 

Public Attributes

 val
 
T matx [2][2]
 
T myFloats [tuple_size]
 

Static Public Attributes

static const int tuple_size = 4
 

Friends

std::ostream & operator<< (std::ostream &os, const UT_Matrix2T< T > &v)
 

Detailed Description

template<typename T>
class UT_Matrix2T< T >

This class implements a 2x2 matrix in row-major order.

Most of Houdini operates with row vectors that are left-multiplied with matrices. e.g., z = v * M

Definition at line 89 of file UT_Matrix2.h.

Member Typedef Documentation

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

Definition at line 93 of file UT_Matrix2.h.

Constructor & Destructor Documentation

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

Construct uninitialized matrix.

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

Default copy constructor.

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

Default move constructor.

template<typename T>
constexpr UT_Matrix2T< T >::UT_Matrix2T ( T  val)
inlineexplicitnoexcept

Construct identity matrix, multipled by scalar.

Definition at line 106 of file UT_Matrix2.h.

template<typename T>
constexpr UT_Matrix2T< T >::UT_Matrix2T ( const fpreal32  m[2][2])
inlineexplicitnoexcept

Construct a deep copy of the input row-major data.

Definition at line 113 of file UT_Matrix2.h.

Member Function Documentation

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

Return the raw matrix data.

Definition at line 397 of file UT_Matrix2.h.

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

Return the raw matrix data.

Definition at line 398 of file UT_Matrix2.h.

template<typename T>
constexpr T UT_Matrix2T< T >::determinant ( ) const
inlinenoexcept

Definition at line 226 of file UT_Matrix2.h.

template<typename T>
template<typename S >
int UT_Matrix2T< T >::eigenvalues ( UT_Vector2T< S > &  r,
UT_Vector2T< S > &  i 
) const

Returns eigenvalues of this matrix.

template<typename T>
static int UT_Matrix2T< T >::entries ( )
inlinestatic

Returns the vector size.

Definition at line 452 of file UT_Matrix2.h.

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

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

Definition at line 424 of file UT_Matrix2.h.

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

Euclidean norm squared.

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

Compute a hash.

Definition at line 402 of file UT_Matrix2.h.

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

Set the matrix to identity.

Definition at line 333 of file UT_Matrix2.h.

template<typename T>
void UT_Matrix2T< T >::initialize ( )
inline

Initialize this matrix to zero.

Definition at line 375 of file UT_Matrix2.h.

template<typename T>
int UT_Matrix2T< T >::invert ( )
inline

Invert this matrix and return 0 if OK, 1 if singular.

Definition at line 238 of file UT_Matrix2.h.

template<typename T>
int UT_Matrix2T< T >::invert ( UT_Matrix2T< T > &  m) const
inline

Invert the matrix and return 0 if OK, 1 if singular. Puts the inverted matrix in m, and leaves this matrix unchanged.

Definition at line 247 of file UT_Matrix2.h.

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

Definition at line 307 of file UT_Matrix2.h.

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

Definition at line 341 of file UT_Matrix2.h.

template<typename T>
bool UT_Matrix2T< T >::isZero ( ) const
inline

Definition at line 348 of file UT_Matrix2.h.

template<typename T>
bool UT_Matrix2T< T >::load ( UT_IStream is)
template<typename T>
bool UT_Matrix2T< T >::load ( UT_JSONParser p)

Methods to serialize to a JSON stream. The matrix is stored as an array of 4 reals.

template<typename T>
constexpr bool UT_Matrix2T< T >::operator!= ( const UT_Matrix2T< T > &  m) const
inlinenoexcept

Definition at line 183 of file UT_Matrix2.h.

template<typename T>
SYS_FORCE_INLINE T& UT_Matrix2T< T >::operator() ( unsigned  row,
unsigned  col 
)
inlinenoexcept

Return a matrix entry. No bounds checking on subscripts.

Definition at line 383 of file UT_Matrix2.h.

template<typename T>
SYS_FORCE_INLINE T UT_Matrix2T< T >::operator() ( unsigned  row,
unsigned  col 
) const
inlinenoexcept

Return a matrix entry. No bounds checking on subscripts.

Definition at line 388 of file UT_Matrix2.h.

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

Return a matrix row. No bounds checking on subscript.

Definition at line 406 of file UT_Matrix2.h.

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

Return a matrix row. No bounds checking on subscript.

Definition at line 411 of file UT_Matrix2.h.

template<typename T>
UT_Matrix2T<T>& UT_Matrix2T< T >::operator*= ( const UT_Matrix2T< T > &  m)
template<typename T>
UT_Matrix2T<T>& UT_Matrix2T< T >::operator*= ( T  scalar)
inline

Definition at line 204 of file UT_Matrix2.h.

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

Definition at line 163 of file UT_Matrix2.h.

template<typename T>
UT_Matrix2T<T>& UT_Matrix2T< T >::operator+= ( T  scalar)
inline

Definition at line 194 of file UT_Matrix2.h.

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

Definition at line 508 of file UT_Matrix2.h.

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

Definition at line 156 of file UT_Matrix2.h.

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

Definition at line 169 of file UT_Matrix2.h.

template<typename T>
UT_Matrix2T<T>& UT_Matrix2T< T >::operator-= ( T  scalar)
inline

Definition at line 200 of file UT_Matrix2.h.

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

Definition at line 518 of file UT_Matrix2.h.

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

Definition at line 210 of file UT_Matrix2.h.

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

Default move assignment operator.

template<typename T>
template<typename S >
UT_Matrix2T<T>& UT_Matrix2T< T >::operator= ( const UT_Matrix3T< S > &  m)

Conversion operator that returns a 2x2 from a 3x3 matrix by ignoring the last row and last column.

template<typename T>
UT_Matrix2T<T>& UT_Matrix2T< T >::operator= ( T  val)
inline

Definition at line 188 of file UT_Matrix2.h.

template<typename T >
template<typename S >
UT_Matrix2T< T > & UT_Matrix2T< T >::operator= ( const UT_Vector2T< S > &  vec)
inline

Definition at line 498 of file UT_Matrix2.h.

template<typename T>
constexpr bool UT_Matrix2T< T >::operator== ( const UT_Matrix2T< T > &  m) const
inlinenoexcept

Definition at line 177 of file UT_Matrix2.h.

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

Return a matrix row. No bounds checking on subscript.

Definition at line 527 of file UT_Matrix2.h.

template<typename T >
UT_Vector2T< T > & UT_Matrix2T< T >::operator[] ( unsigned  row)
inline

Return a matrix row. No bounds checking on subscript.

Definition at line 535 of file UT_Matrix2.h.

template<typename T>
void UT_Matrix2T< T >::outAsciiNoName ( std::ostream &  os) const
template<typename T>
template<typename S >
void UT_Matrix2T< T >::outerproductUpdate ( T  b,
const UT_Vector2T< S > &  v1,
const UT_Vector2T< S > &  v2 
)
inline

Definition at line 320 of file UT_Matrix2.h.

template<typename T>
void UT_Matrix2T< T >::rotate ( T  theta)
inline

Rotate by theta radians.

Definition at line 360 of file UT_Matrix2.h.

template<typename T>
static UT_Matrix2T<T> UT_Matrix2T< T >::rotationMat ( T  theta)
static

Create a rotation matrix for the given angle in radians.

template<typename T>
int UT_Matrix2T< T >::save ( std::ostream &  os,
int  binary 
) const
template<typename T>
bool UT_Matrix2T< T >::save ( UT_JSONWriter w) const

Methods to serialize to a JSON stream. The matrix is stored as an array of 4 reals.

template<typename T>
bool UT_Matrix2T< T >::save ( UT_JSONValue v) const

Methods to serialize to a JSON stream. The matrix is stored as an array of 4 reals.

template<typename T>
void UT_Matrix2T< T >::scale ( T  sx,
T  sy 
)
inline

Multiply this matrix by a scale matrix with diagonal (sx, sy):

Definition at line 365 of file UT_Matrix2.h.

template<typename T>
void UT_Matrix2T< T >::scale ( const UT_Vector2T< T > &  s)
inline

Multiply this matrix by a scale matrix with diagonal (sx, sy):

Definition at line 370 of file UT_Matrix2.h.

template<typename T>
template<typename S >
int UT_Matrix2T< T >::solve ( const UT_Vector2T< S > &  b,
UT_Vector2T< S > &  x 
) const
inline

Definition at line 277 of file UT_Matrix2.h.

template<typename T>
UT_Matrix2T< T >::T ( )
template<typename T>
T UT_Matrix2T< T >::tolerance ( ) const

Returns the tolerance of our class.

template<>
int32 UT_Matrix2T< int32 >::tolerance ( ) const
inline

Definition at line 483 of file UT_Matrix2.h.

template<>
int64 UT_Matrix2T< int64 >::tolerance ( ) const
inline

Definition at line 490 of file UT_Matrix2.h.

template<typename T>
constexpr T UT_Matrix2T< T >::trace ( ) const
inlinenoexcept

Definition at line 230 of file UT_Matrix2.h.

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

Definition at line 299 of file UT_Matrix2.h.

template<typename T>
UT_Matrix2T<T> UT_Matrix2T< T >::transpose ( ) const
template<typename T>
void UT_Matrix2T< T >::zero ( )
inline

Set the matrix to zero.

Definition at line 339 of file UT_Matrix2.h.

Friends And Related Function Documentation

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

Definition at line 444 of file UT_Matrix2.h.

Member Data Documentation

template<typename T>
T UT_Matrix2T< T >::matx[2][2]

Definition at line 459 of file UT_Matrix2.h.

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

Definition at line 460 of file UT_Matrix2.h.

template<typename T>
const int UT_Matrix2T< T >::tuple_size = 4
static

Definition at line 94 of file UT_Matrix2.h.

template<typename T>
UT_Matrix2T< T >::val
Initial value:
{

Definition at line 108 of file UT_Matrix2.h.


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