VMTK
VMATH_NAMESPACE::Matrix3< T > Class Template Reference

#include <vmath.h>

Public Member Functions

 Matrix3 ()
 
 Matrix3 (const T *dt)
 
 Matrix3 (const Matrix3< T > &src)
 
template<class FromT >
 Matrix3 (const Matrix3< FromT > &src)
 
void identity ()
 
Vector3< T > vectorProductMatrix (const Vector3< T > &v) const
 vectorProductMatrix: Multiplication function More...
 
bool operator== (const Matrix3< T > &rhs) const
 
bool operator!= (const Matrix3< T > &rhs) const
 
T & at (int x, int y)
 
const T & at (int x, int y) const
 
T & operator() (int i, int j)
 
const T & operator() (int i, int j) const
 
Matrix3< T > & operator= (const Matrix3< T > &rhs)
 
template<class FromT >
Matrix3< T > & operator= (const Matrix3< FromT > &rhs)
 
Matrix3< T > & operator= (const T *rhs)
 
Matrix3< T > operator+ (const Matrix3< T > &rhs) const
 
Matrix3< T > operator- (const Matrix3< T > &rhs) const
 
Matrix3< T > operator+ (T rhs) const
 
Matrix3< T > operator- (T rhs) const
 
Matrix3< T > operator* (T rhs) const
 
Matrix3< T > operator/ (T rhs) const
 
Vector3< T > operator* (const Vector3< T > &rhs) const
 
Matrix3< T > operator* (Matrix3< T > rhs) const
 
Matrix3< T > transpose ()
 
Matrix3< T > lerp (T fact, const Matrix3< T > &rhs) const
 
det ()
 
Matrix3< T > inverse ()
 
 operator T* ()
 
 operator const T * () const
 
std::string toString () const
 

Static Public Member Functions

static Vector3< T > vectorProductMatrix (const Vector3< T > v, Matrix3< T > m)
 vectorProductMatrix: Multiplication function More...
 
static Matrix3< T > createRotationAroundAxis (T xDeg, T yDeg, T zDeg)
 
static Vector3< T > getEulerAngles (Matrix3< T > R)
 
template<class It >
static Matrix3< T > fromOde (const It *mat)
 
template<class FromT >
static Matrix3< T > fromRowMajorArray (const FromT *arr)
 
template<class FromT >
static Matrix3< T > fromColumnMajorArray (const FromT *arr)
 

Public Attributes

data [9]
 Data stored in column major order.
 

Friends

std::ostream & operator<< (std::ostream &lhs, const Matrix3< T > &rhs)
 

Detailed Description

template<class T>
class VMATH_NAMESPACE::Matrix3< T >

Class for matrix 3x3.

Note
Data stored in this matrix are in column major order. This arrangement suits OpenGL. If you're using row major matrix, consider using fromRowMajorArray as way for construction Matrix3<T> instance.

Definition at line 1749 of file vmath.h.

Constructor & Destructor Documentation

◆ Matrix3() [1/4]

template<class T>
VMATH_NAMESPACE::Matrix3< T >::Matrix3 ( )
inline

Creates identity matrix

Definition at line 1759 of file vmath.h.

◆ Matrix3() [2/4]

template<class T>
VMATH_NAMESPACE::Matrix3< T >::Matrix3 ( const T *  dt)
inline

Copy matrix values from array (these data must be in column major order!)

Definition at line 1769 of file vmath.h.

◆ Matrix3() [3/4]

template<class T>
VMATH_NAMESPACE::Matrix3< T >::Matrix3 ( const Matrix3< T > &  src)
inline

Copy constructor.

Parameters
srcData source for new created instance of Matrix3

Definition at line 1778 of file vmath.h.

◆ Matrix3() [4/4]

template<class T>
template<class FromT >
VMATH_NAMESPACE::Matrix3< T >::Matrix3 ( const Matrix3< FromT > &  src)
inline

Copy casting constructor.

Parameters
srcData source for new created instance of Matrix3

Definition at line 1788 of file vmath.h.

Member Function Documentation

◆ at() [1/2]

template<class T>
T& VMATH_NAMESPACE::Matrix3< T >::at ( int  x,
int  y 
)
inline

Get reference to element at position (x,y).

Parameters
xNumber of column (0..2)
yNumber of row (0..2)

Definition at line 1997 of file vmath.h.

Here is the caller graph for this function:

◆ at() [2/2]

template<class T>
const T& VMATH_NAMESPACE::Matrix3< T >::at ( int  x,
int  y 
) const
inline

Get constant reference to element at position (x,y).

Parameters
xNumber of column (0..2)
yNumber of row (0..2)

Definition at line 2009 of file vmath.h.

◆ createRotationAroundAxis()

template<class T>
static Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::createRotationAroundAxis ( xDeg,
yDeg,
zDeg 
)
inlinestatic

Creates rotation matrix by rotation around axis.

Parameters
xDegAngle (in degrees) of rotation around axis X.
yDegAngle (in degrees) of rotation around axis Y.
zDegAngle (in degrees) of rotation around axis Z.

Definition at line 1845 of file vmath.h.

Here is the call graph for this function:

◆ fromColumnMajorArray()

template<class T>
template<class FromT >
static Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::fromColumnMajorArray ( const FromT *  arr)
inlinestatic

Creates new matrix 3x3 from array that represents such matrix 3x3 as array of tightly packed elements in column major order.

Parameters
arrAn array of elements for 3x3 matrix in column major order.
Returns
An instance of Matrix3<T> representing arr

Definition at line 1952 of file vmath.h.

◆ fromOde()

template<class T>
template<class It >
static Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::fromOde ( const It *  mat)
inlinestatic

Creates rotation matrix from ODE Matrix.

Definition at line 1915 of file vmath.h.

Here is the call graph for this function:

◆ fromRowMajorArray()

template<class T>
template<class FromT >
static Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::fromRowMajorArray ( const FromT *  arr)
inlinestatic

Creates new matrix 3x3 from array that represents such matrix 3x3 as array of tightly packed elements in row major order.

Parameters
arrAn array of elements for 3x3 matrix in row major order.
Returns
An instance of Matrix3<T> representing arr

Definition at line 1935 of file vmath.h.

◆ identity()

template<class T>
void VMATH_NAMESPACE::Matrix3< T >::identity ( )
inline

Resets matrix to be identity matrix

Definition at line 1799 of file vmath.h.

◆ inverse()

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::inverse ( )
inline

Computes inverse matrix

Returns
Inverse matrix of this matrix.

Definition at line 2229 of file vmath.h.

Here is the call graph for this function:

◆ lerp()

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::lerp ( fact,
const Matrix3< T > &  rhs 
) const
inline

Linear interpolation of two matrices

Parameters
factFactor of interpolation. For translation from positon of this matrix (lhs) to matrix rhs, values of factor goes from 0.0 to 1.0.
rhsSecond Matrix for interpolation
Note
However values of fact parameter are reasonable only in interval [0.0 , 1.0], you can pass also values outside of this interval and you can get result (extrapolation?)

Definition at line 2213 of file vmath.h.

◆ operator const T *()

template<class T>
VMATH_NAMESPACE::Matrix3< T >::operator const T * ( ) const
inline

Conversion to pointer operator

Returns
Constant Pointer to internally stored (in management of class Matrix3<T>) used for passing Matrix3<T> values to gl*[fd]v functions.

Definition at line 2261 of file vmath.h.

◆ operator T*()

template<class T>
VMATH_NAMESPACE::Matrix3< T >::operator T* ( )
inline

Conversion to pointer operator

Returns
Pointer to internally stored (in management of class Matrix3<T>) used for passing Matrix3<T> values to gl*[fd]v functions.

Definition at line 2251 of file vmath.h.

◆ operator!=()

template<class T>
bool VMATH_NAMESPACE::Matrix3< T >::operator!= ( const Matrix3< T > &  rhs) const
inline

Inequality test operator

Parameters
rhsRight hand side argument of binary operator.
Returns
not (lhs == rhs) :-P

Definition at line 1986 of file vmath.h.

◆ operator()() [1/2]

template<class T>
T& VMATH_NAMESPACE::Matrix3< T >::operator() ( int  i,
int  j 
)
inline

Get reference to element at position (i,j), with math matrix notation

Parameters
iNumber of row (1..3)
jNumber of column (1..3)

Definition at line 2021 of file vmath.h.

◆ operator()() [2/2]

template<class T>
const T& VMATH_NAMESPACE::Matrix3< T >::operator() ( int  i,
int  j 
) const
inline

Get constant reference to element at position (i,j), with math matrix notation

Parameters
iNumber of row (1..3)
jNumber of column (1..3)

Definition at line 2033 of file vmath.h.

◆ operator*() [1/3]

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::operator* ( rhs) const
inline

Multiplication operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2134 of file vmath.h.

◆ operator*() [2/3]

template<class T>
Vector3<T> VMATH_NAMESPACE::Matrix3< T >::operator* ( const Vector3< T > &  rhs) const
inline

Multiplication operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2159 of file vmath.h.

◆ operator*() [3/3]

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::operator* ( Matrix3< T >  rhs) const
inline

Multiplication operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2170 of file vmath.h.

Here is the call graph for this function:

◆ operator+() [1/2]

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::operator+ ( const Matrix3< T > &  rhs) const
inline

Addition operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2085 of file vmath.h.

◆ operator+() [2/2]

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::operator+ ( rhs) const
inline

Addition operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2110 of file vmath.h.

◆ operator-() [1/2]

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::operator- ( const Matrix3< T > &  rhs) const
inline

Subtraction operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2097 of file vmath.h.

◆ operator-() [2/2]

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::operator- ( rhs) const
inline

Subtraction operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2122 of file vmath.h.

◆ operator/()

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::operator/ ( rhs) const
inline

Division operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2146 of file vmath.h.

◆ operator=() [1/3]

template<class T>
Matrix3<T>& VMATH_NAMESPACE::Matrix3< T >::operator= ( const Matrix3< T > &  rhs)
inline

Copy operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2044 of file vmath.h.

◆ operator=() [2/3]

template<class T>
template<class FromT >
Matrix3<T>& VMATH_NAMESPACE::Matrix3< T >::operator= ( const Matrix3< FromT > &  rhs)
inline

Copy casting operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2055 of file vmath.h.

◆ operator=() [3/3]

template<class T>
Matrix3<T>& VMATH_NAMESPACE::Matrix3< T >::operator= ( const T *  rhs)
inline

Copy operator

Parameters
rhsRight hand side argument of binary operator.

Definition at line 2068 of file vmath.h.

◆ operator==()

template<class T>
bool VMATH_NAMESPACE::Matrix3< T >::operator== ( const Matrix3< T > &  rhs) const
inline

Equality test operator

Parameters
rhsRight hand side argument of binary operator.
Note
Test of equality is based of threshold EPSILON value. To be two values equal, must satisfy this condition all elements of matrix | lhs[i] - rhs[i] | < EPSILON, same for y-coordinate, z-coordinate, and w-coordinate.

Definition at line 1971 of file vmath.h.

◆ toString()

template<class T>
std::string VMATH_NAMESPACE::Matrix3< T >::toString ( ) const
inline

Gets string representation.

Definition at line 2290 of file vmath.h.

◆ transpose()

template<class T>
Matrix3<T> VMATH_NAMESPACE::Matrix3< T >::transpose ( )
inline

Transpose matrix.

Definition at line 2191 of file vmath.h.

Here is the call graph for this function:

◆ vectorProductMatrix() [1/2]

template<class T>
Vector3<T> VMATH_NAMESPACE::Matrix3< T >::vectorProductMatrix ( const Vector3< T > &  v) const
inline

vectorProductMatrix: Multiplication function

Parameters
vvector3
Returns
v multiplied by currentMatrix (Matrix3)

Definition at line 1810 of file vmath.h.

◆ vectorProductMatrix() [2/2]

template<class T>
static Vector3<T> VMATH_NAMESPACE::Matrix3< T >::vectorProductMatrix ( const Vector3< T >  v,
Matrix3< T >  m 
)
inlinestatic

vectorProductMatrix: Multiplication function

Parameters
vrow vector3
mMatrix3
Returns
Vector3: v * m

Definition at line 1827 of file vmath.h.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

template<class T>
std::ostream& operator<< ( std::ostream &  lhs,
const Matrix3< T > &  rhs 
)
friend

Output to stream operator

Parameters
lhsLeft hand side argument of operator (commonly ostream instance).
rhsRight hand side argument of operator.
Returns
Left hand side argument - the ostream object passed to operator.

Definition at line 2273 of file vmath.h.


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