Cafu Engine
cf::math::Matrix3x3T< T > Class Template Reference

This class represents a generic 3x3 matrix. More...

#include "Matrix3x3.hpp"

Public Member Functions

 Matrix3x3T ()
 The default constructor for creating a "1" (identity) matrix. More...
 
 Matrix3x3T (const float M[3][3])
 Constructor for creating an arbitrary matrix. More...
 
 Matrix3x3T (const double M[3][3])
 Constructor for creating an arbitrary matrix. More...
 
 Matrix3x3T (T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22)
 Constructor for creating an arbitrary matrix. More...
 
 Matrix3x3T (const AnglesT< T > &Angles)
 Constructs a rotation matrix from the given angles. More...
 
 Matrix3x3T (const QuaternionT< T > &Quat)
 Constructs a rotation matrix from the given quaternion. More...
 
T * operator[] (unsigned long i)
 Returns the i-th row of this matrix. More...
 
const T * operator[] (unsigned long i) const
 Returns the i-th row of this matrix. More...
 
Vector3T< T > GetAxis (unsigned int i) const
 Returns the i-th column of this matrix. More...
 
Matrix3x3T operator* (const Matrix3x3T &Other) const
 Computes M*Other, that is, the matrix product of this and the Other matrix. More...
 
Vector3T< T > operator* (const Vector3T< T > &v) const
 Computes M*v, where M is this matrix. More...
 
bool operator== (const Matrix3x3T &Other) const
 Determines if this matrix is equal to Other. More...
 
bool operator!= (const Matrix3x3T &Other) const
 Determines if this matrix is not equal to Other. More...
 
void Scale_MS (T sx, T sy, T sz)
 Computes M=M*S, where S=GetScaleMatrix (sx, sy, sz). More...
 
void Scale_SM (T sx, T sy, T sz)
 Computes M=S*M, where S=GetScaleMatrix (sx, sy, sz). More...
 
void RotateX_MR (T Angle)
 Computes M=M*R, where R=GetRotateXMatrix (Angle). More...
 
void RotateX_RM (T Angle)
 Computes M=R*M, where R=GetRotateXMatrix (Angle). More...
 
void RotateY_MR (T Angle)
 Computes M=M*R, where R=GetRotateYMatrix (Angle). More...
 
void RotateY_RM (T Angle)
 Computes M=R*M, where R=GetRotateYMatrix (Angle). More...
 
void RotateZ_MR (T Angle)
 Computes M=M*R, where R=GetRotateZMatrix (Angle). More...
 
void RotateZ_RM (T Angle)
 Computes M=R*M, where R=GetRotateZMatrix (Angle). More...
 
bool IsEqual (const Matrix3x3T &Other, const T Epsilon=0) const
 Returns whether this matrix is equal to Other. More...
 
Vector3T< T > Mul (const Vector3T< T > &v) const
 Computes M*v, where M is this matrix. More...
 
Vector3T< T > MulTranspose (const Vector3T< T > &v) const
 A shortcut for M.GetTranspose()*v, where M is this matrix. More...
 
void Mul (const T v[3], T out[3]) const
 Computes M*v, where M is this matrix. More...
 
Matrix3x3T GetInverse (bool *Result=NULL) const
 Computes the inverse of this matrix. More...
 
Matrix3x3T GetTranspose () const
 Returns the transpose of this matrix. More...
 
AnglesT< T > ToAngles_COMPAT () const
 Converts the rotation that is described by this matrix to an AnglesT<T> instance that describes the same rotation. More...
 

Static Public Member Functions

Named constructors.
static Matrix3x3T GetScaleMatrix (T sx, T sy, T sz)
 Returns a scale matrix with scale factors (sx sy sz). More...
 
static Matrix3x3T GetRotateXMatrix (T Angle)
 Returns a rotation matrix about Angle degrees around the x-axis. More...
 
static Matrix3x3T GetRotateYMatrix (T Angle)
 Returns a rotation matrix about Angle degrees around the y-axis. More...
 
static Matrix3x3T GetRotateZMatrix (T Angle)
 Returns a rotation matrix about Angle degrees around the z-axis. More...
 
static Matrix3x3T GetRotateMatrix (T Angle, const Vector3T< T > &Axis)
 Returns a rotation matrix about Angle degrees around Axis. More...
 
static Matrix3x3T GetFromAngles_COMPAT (const AnglesT< T > &Angles)
 Returns a rotation matrix built from the given angles in a "compatibility-to-old-code" fashion. More...
 

Public Attributes

m [3][3]
 The matrix values. More...
 

Static Public Attributes

static const Matrix3x3T< T > Identity
 Identity matrix. More...
 

Detailed Description

template<class T>
class cf::math::Matrix3x3T< T >

This class represents a generic 3x3 matrix.

Constructor & Destructor Documentation

template<class T>
cf::math::Matrix3x3T< T >::Matrix3x3T ( )
inline

The default constructor for creating a "1" (identity) matrix.

template<class T>
cf::math::Matrix3x3T< T >::Matrix3x3T ( const float  M[3][3])
inline

Constructor for creating an arbitrary matrix.

template<class T>
cf::math::Matrix3x3T< T >::Matrix3x3T ( const double  M[3][3])
inline

Constructor for creating an arbitrary matrix.

template<class T>
cf::math::Matrix3x3T< T >::Matrix3x3T ( m00,
m01,
m02,
m10,
m11,
m12,
m20,
m21,
m22 
)
inline

Constructor for creating an arbitrary matrix.

template<class T>
Matrix3x3T::Matrix3x3T ( const AnglesT< T > &  Angles)

Constructs a rotation matrix from the given angles.

See the documentation of the AnglesT class for details.

template<class T>
Matrix3x3T::Matrix3x3T ( const QuaternionT< T > &  Quat)

Constructs a rotation matrix from the given quaternion.

Member Function Documentation

template<class T>
Vector3T<T> cf::math::Matrix3x3T< T >::GetAxis ( unsigned int  i) const
inline

Returns the i-th column of this matrix.

The i-th column of the matrix corresponds to the i-th axis of the represented coordinate-system.

template<class T>
Matrix3x3T< T > Matrix3x3T::GetFromAngles_COMPAT ( const AnglesT< T > &  Angles)
static

Returns a rotation matrix built from the given angles in a "compatibility-to-old-code" fashion.

template<class T >
Matrix3x3T< T > Matrix3x3T::GetInverse ( bool *  Result = NULL) const

Computes the inverse of this matrix.

Parameters
ResultWhether the operation was successful.
Returns
If this matrix is invertible, the inverse is returned by this method, and *Result, if not at NULL, is set to true. Otherwise, an undefined matrix is returned, and *Result, if not at NULL, is set to false.
template<class T>
Matrix3x3T< T > Matrix3x3T::GetRotateMatrix ( Angle,
const Vector3T< T > &  Axis 
)
static

Returns a rotation matrix about Angle degrees around Axis.

template<class T>
Matrix3x3T< T > Matrix3x3T::GetRotateXMatrix ( Angle)
static

Returns a rotation matrix about Angle degrees around the x-axis.

template<class T>
Matrix3x3T< T > Matrix3x3T::GetRotateYMatrix ( Angle)
static

Returns a rotation matrix about Angle degrees around the y-axis.

template<class T>
Matrix3x3T< T > Matrix3x3T::GetRotateZMatrix ( Angle)
static

Returns a rotation matrix about Angle degrees around the z-axis.

template<class T>
Matrix3x3T< T > Matrix3x3T::GetScaleMatrix ( sx,
sy,
sz 
)
static

Returns a scale matrix with scale factors (sx sy sz).

template<class T >
Matrix3x3T< T > Matrix3x3T::GetTranspose ( ) const

Returns the transpose of this matrix.

Returns
The transpose of this matrix.
template<class T>
bool cf::math::Matrix3x3T< T >::IsEqual ( const Matrix3x3T< T > &  Other,
const T  Epsilon = 0 
) const
inline

Returns whether this matrix is equal to Other.

The matrices are considered equal if the element-wise comparison yields no difference larger than Epsilon.

Parameters
OtherMatrix to compare to.
EpsilonTolerance value.
See Also
operator ==
template<class T>
Vector3T<T> cf::math::Matrix3x3T< T >::Mul ( const Vector3T< T > &  v) const
inline

Computes M*v, where M is this matrix.

Parameters
vA vector.
Returns
M*v.
template<class T>
void cf::math::Matrix3x3T< T >::Mul ( const T  v[3],
out[3] 
) const
inline

Computes M*v, where M is this matrix.

Parameters
vThe three-component vector that is multiplied with M.
outThe three-component result vector.
Returns
The three-component result vector M*v is returned via the out parameter.
template<class T>
Vector3T<T> cf::math::Matrix3x3T< T >::MulTranspose ( const Vector3T< T > &  v) const
inline

A shortcut for M.GetTranspose()*v, where M is this matrix.

Parameters
vA vector.
Returns
Mt*v, where Mt is the transpose of this matrix.
template<class T>
bool cf::math::Matrix3x3T< T >::operator!= ( const Matrix3x3T< T > &  Other) const
inline

Determines if this matrix is not equal to Other.

Note that this is a bit-wise comparison, no epsilon is taken into account.

Parameters
OtherThe other matrix (right side).
Returns
whether this matrix and Other are not equal.
template<class T >
Matrix3x3T< T > Matrix3x3T::operator* ( const Matrix3x3T< T > &  Other) const

Computes M*Other, that is, the matrix product of this and the Other matrix.

Parameters
OtherThe other matrix (right side).
Returns
The matrix product of this and the Other matrix.
template<class T>
Vector3T<T> cf::math::Matrix3x3T< T >::operator* ( const Vector3T< T > &  v) const
inline

Computes M*v, where M is this matrix.

Parameters
vA vector.
Returns
M*v.
template<class T>
bool cf::math::Matrix3x3T< T >::operator== ( const Matrix3x3T< T > &  Other) const
inline

Determines if this matrix is equal to Other.

Note that this is a bit-wise comparison, no epsilon is taken into account.

Parameters
OtherThe other matrix (right side).
Returns
whether this matrix and Other are equal.
template<class T>
T* cf::math::Matrix3x3T< T >::operator[] ( unsigned long  i)
inline

Returns the i-th row of this matrix.

template<class T>
const T* cf::math::Matrix3x3T< T >::operator[] ( unsigned long  i) const
inline

Returns the i-th row of this matrix.

template<class T>
void Matrix3x3T::RotateX_MR ( Angle)

Computes M=M*R, where R=GetRotateXMatrix (Angle).

template<class T>
void Matrix3x3T::RotateX_RM ( Angle)

Computes M=R*M, where R=GetRotateXMatrix (Angle).

template<class T>
void Matrix3x3T::RotateY_MR ( Angle)

Computes M=M*R, where R=GetRotateYMatrix (Angle).

template<class T>
void Matrix3x3T::RotateY_RM ( Angle)

Computes M=R*M, where R=GetRotateYMatrix (Angle).

template<class T>
void Matrix3x3T::RotateZ_MR ( Angle)

Computes M=M*R, where R=GetRotateZMatrix (Angle).

template<class T>
void Matrix3x3T::RotateZ_RM ( Angle)

Computes M=R*M, where R=GetRotateZMatrix (Angle).

template<class T>
void Matrix3x3T::Scale_MS ( sx,
sy,
sz 
)

Computes M=M*S, where S=GetScaleMatrix (sx, sy, sz).

template<class T>
void Matrix3x3T::Scale_SM ( sx,
sy,
sz 
)

Computes M=S*M, where S=GetScaleMatrix (sx, sy, sz).

template<class T >
AnglesT< T > Matrix3x3T::ToAngles_COMPAT ( ) const

Converts the rotation that is described by this matrix to an AnglesT<T> instance that describes the same rotation.

Returns
An AnglesT<T> instance that describes the same rotation as this matrix.

Member Data Documentation

template<class T>
const Matrix3x3T< T > Matrix3x3T::Identity
static

Identity matrix.

template<class T>
T cf::math::Matrix3x3T< T >::m[3][3]

The matrix values.


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