CodeSubWars 0.4.7b
ARSTD::Matrix44< Type > Struct Template Reference

#include <Matrix44.h>

Public Member Functions

 Matrix44 (bool bInitAsIdentity=true)
 
 Matrix44 (const Vector3< Type > &vecTranslation)
 
 Matrix44 (const Matrix< Type > &mat)
 
 Matrix44 (const Matrix33< Type > &rotation, const Vector3< Type > &vecTranslation)
 
 Matrix44 (const Quaternion< Type > &rotation, const Vector3< Type > &vecTranslation)
 
 Matrix44 (const Vector3< Type > &vecXAxis, const Vector3< Type > &vecYAxis, const Vector3< Type > &vecZAxis, const Vector3< Type > &vecTranslation)
 
 Matrix44 (const Vector4< Type > &vecColumn0, const Vector4< Type > &vecColumn1, const Vector4< Type > &vecColumn2, const Vector4< Type > &vecColumn3)
 
Matrix44< Type > & operator*= (const Matrix44< Type > &other)
 
Vector3< Type > & getXAxis ()
 
const Vector3< Type > & getXAxis () const
 
void setXAxis (const Vector3< Type > &vecXAxis)
 
Vector3< Type > & getYAxis ()
 
const Vector3< Type > & getYAxis () const
 
void setYAxis (const Vector3< Type > &vecYAxis)
 
Vector3< Type > & getZAxis ()
 
const Vector3< Type > & getZAxis () const
 
void setZAxis (const Vector3< Type > &vecZAxis)
 
Vector3< Type > & getTranslation ()
 
const Vector3< Type > & getTranslation () const
 
void setTranslation (const Vector3< Type > &vecTranslation)
 
void setIdentity ()
 
bool isIdentity (const Type &epsilon=EPSILON) const
 
const Matrix33< Type > getRotationAsMatrix33 () const
 
const Quaternion< Type > getRotationAsQuaternion () const
 
void setRotation (const Vector3< Type > &vecAxis, const Type &angle)
 
void setRotation (const Matrix33< Type > &mat)
 
void setRotation (const Quaternion< Type > &quat)
 
void transpose ()
 
void transposeRot ()
 
void invert ()
 
void makeHomogeneous (const EAxis &axis)
 

Static Public Member Functions

static Matrix44< Type > inverse (const Matrix44< Type > &mat)
 
static Matrix44< Type > slerp (const Matrix44< Type > &mat1, const Matrix44< Type > &mat2, const double &t)
 

Static Public Attributes

static const Matrix44< Type > IDENTITY
 

Related Functions

(Note that these are not member functions.)

template<class Type >
const Matrix44< Type > operator* (const Matrix44< Type > &lhs, const Matrix44< Type > &rhs)
 
template<class Type >
const Vector3< Type > operator* (const Matrix44< Type > &lhs, const Vector3< Type > &rhs)
 
template<class Type >
const Vector4< Type > operator* (const Matrix44< Type > &lhs, const Vector4< Type > &rhs)
 
template<class Type >
bool equals (const Matrix44< Type > &lhs, const Matrix44< Type > &rhs, double fEpsilon=EPSILON)
 
template<class Type >
bool operator== (const Matrix44< Type > &lhs, const Matrix44< Type > &rhs)
 
template<class Type >
bool operator!= (const Matrix44< Type > &lhs, const Matrix44< Type > &rhs)
 
template<class Type >
std::ostream & operator<< (std::ostream &stream, const Matrix44< Type > &mat)
 
template<class Type >
std::istream & operator>> (std::istream &stream, Matrix44< Type > &mat)
 

Detailed Description

template<class Type>
struct ARSTD::Matrix44< Type >

This represents a 4x4 Matrix

Constructor & Destructor Documentation

◆ Matrix44() [1/7]

template<class Type >
ARSTD::Matrix44< Type >::Matrix44 ( bool  bInitAsIdentity = true)
explicit

Constructor, which is as default not initialized

Parameters
bInitAsIdentityIf set to false the matrix is not initialized, otherwise an identity matrix is initialized

◆ Matrix44() [2/7]

template<class Type >
ARSTD::Matrix44< Type >::Matrix44 ( const Vector3< Type > &  vecTranslation)
explicit

Contructs a translation matrix by given translation vector

Parameters
vecTranslationThe translation vector

◆ Matrix44() [3/7]

template<class Type >
ARSTD::Matrix44< Type >::Matrix44 ( const Matrix< Type > &  mat)
explicit

Constructs a matrix with the given generic matrix elements

Parameters
matThe generic matrix from where to set
Precondition
mat has to be a 4x4 matrix

◆ Matrix44() [4/7]

template<class Type >
ARSTD::Matrix44< Type >::Matrix44 ( const Matrix33< Type > &  rotation,
const Vector3< Type > &  vecTranslation 
)

Constructs a matrix with a given rotation and translation The homogenous value (ww) of the 4th column is set to 1

Parameters
rotationThe rotation 3x3 matrix
vecTranslationThe translation vector

◆ Matrix44() [5/7]

template<class Type >
ARSTD::Matrix44< Type >::Matrix44 ( const Quaternion< Type > &  rotation,
const Vector3< Type > &  vecTranslation 
)

Constructs a matrix with a given rotation and translation The homogenous value (ww) of the 4th column is set to 1

Parameters
rotationThe rotation quaternion
vecTranslationThe translation vector

◆ Matrix44() [6/7]

template<class Type >
ARSTD::Matrix44< Type >::Matrix44 ( const Vector3< Type > &  vecXAxis,
const Vector3< Type > &  vecYAxis,
const Vector3< Type > &  vecZAxis,
const Vector3< Type > &  vecTranslation 
)

Constructs a matrix with 4 three-component vectors, one for each column The forth row of the matrix is set to (0 0 0 1)

Parameters
vecXAxisThe x-axis vector
vecYAxisThe y-axis vector
vecZAxisThe z-axis vector
vecTranslationThe translation vector

◆ Matrix44() [7/7]

template<class Type >
ARSTD::Matrix44< Type >::Matrix44 ( const Vector4< Type > &  vecColumn0,
const Vector4< Type > &  vecColumn1,
const Vector4< Type > &  vecColumn2,
const Vector4< Type > &  vecColumn3 
)

Constructs a the matrix with 4 four-component vectors, one for each column

Parameters
vecXAxisThe x-axis vector
vecYAxisThe y-axis vector
vecZAxisThe z-axis vector
vecTranslationThe translation that vector.

Member Function Documentation

◆ getRotationAsMatrix33()

template<class Type >
const Matrix33< Type > ARSTD::Matrix44< Type >::getRotationAsMatrix33 ( ) const

Returns the rotation as 3x3 matrix

Returns
The 3x3 matrix

◆ getRotationAsQuaternion()

template<class Type >
const Quaternion< Type > ARSTD::Matrix44< Type >::getRotationAsQuaternion ( ) const

Returns the rotation as quaternion

Returns
The quaternion

◆ getTranslation() [1/2]

template<class Type >
Vector3< Type > & ARSTD::Matrix44< Type >::getTranslation ( )

Gives access to the translation vector

◆ getTranslation() [2/2]

template<class Type >
const Vector3< Type > & ARSTD::Matrix44< Type >::getTranslation ( ) const

Returns the translation vector

◆ getXAxis() [1/2]

template<class Type >
Vector3< Type > & ARSTD::Matrix44< Type >::getXAxis ( )

Gives access to the x-axis of the 3x3 rotational part.

◆ getXAxis() [2/2]

template<class Type >
const Vector3< Type > & ARSTD::Matrix44< Type >::getXAxis ( ) const

Returns the x-axis vector

◆ getYAxis() [1/2]

template<class Type >
Vector3< Type > & ARSTD::Matrix44< Type >::getYAxis ( )

Gives access to y-axis vector

◆ getYAxis() [2/2]

template<class Type >
const Vector3< Type > & ARSTD::Matrix44< Type >::getYAxis ( ) const

Returns the y-axis vector

◆ getZAxis() [1/2]

template<class Type >
Vector3< Type > & ARSTD::Matrix44< Type >::getZAxis ( )

Gives access to the z-axis vector

◆ getZAxis() [2/2]

template<class Type >
const Vector3< Type > & ARSTD::Matrix44< Type >::getZAxis ( ) const

Returns the z-axis vector

◆ inverse()

template<class Type >
static Matrix44< Type > ARSTD::Matrix44< Type >::inverse ( const Matrix44< Type > &  mat)
static

Inverts the matrix

Parameters
matThe 4x4 matrix
Returns
The inverted matrix

◆ invert()

template<class Type >
void ARSTD::Matrix44< Type >::invert ( )

Inverts the matrix

◆ isIdentity()

template<class Type >
bool ARSTD::Matrix44< Type >::isIdentity ( const Type &  epsilon = EPSILON) const

Checks if the matrix is to identity matrix

Parameters
epsilon
Returns
true, if the matrix is equal, otherwise false

◆ makeHomogeneous()

template<class Type >
void ARSTD::Matrix44< Type >::makeHomogeneous ( const EAxis &  axis)

Rebuilds a homogeneous transformation matrix by discarding a given axis

Parameters
axisThe axis, that is discarded

◆ operator*=()

template<class Type >
Matrix44< Type > & ARSTD::Matrix44< Type >::operator*= ( const Matrix44< Type > &  other)

Matrix multiplication

Parameters
otherThe other matrix
Returns
The multiplied matrix

◆ setIdentity()

template<class Type >
void ARSTD::Matrix44< Type >::setIdentity ( )

Sets the matrix to the identity

◆ setRotation() [1/3]

template<class Type >
void ARSTD::Matrix44< Type >::setRotation ( const Matrix33< Type > &  mat)

Sets the rotation using 3x3 matrix

Parameters
matThe 3x3 Matrix

◆ setRotation() [2/3]

template<class Type >
void ARSTD::Matrix44< Type >::setRotation ( const Quaternion< Type > &  quat)

Sets the rotation using quaternion

Parameters
rotationThe quaternion

◆ setRotation() [3/3]

template<class Type >
void ARSTD::Matrix44< Type >::setRotation ( const Vector3< Type > &  vecAxis,
const Type &  angle 
)

Sets the rotation using rotation axis and rotation angle

Parameters
vecAxisThe rotation axis
angleThe rotation angle

◆ setTranslation()

template<class Type >
void ARSTD::Matrix44< Type >::setTranslation ( const Vector3< Type > &  vecTranslation)

Sets the translation vector

◆ setXAxis()

template<class Type >
void ARSTD::Matrix44< Type >::setXAxis ( const Vector3< Type > &  vecXAxis)

Sets the x-axis vector

◆ setYAxis()

template<class Type >
void ARSTD::Matrix44< Type >::setYAxis ( const Vector3< Type > &  vecYAxis)

Sets the y-axis vector

◆ setZAxis()

template<class Type >
void ARSTD::Matrix44< Type >::setZAxis ( const Vector3< Type > &  vecZAxis)

Sets the z-axis vector

◆ slerp()

template<class Type >
static Matrix44< Type > ARSTD::Matrix44< Type >::slerp ( const Matrix44< Type > &  mat1,
const Matrix44< Type > &  mat2,
const double &  t 
)
static

Spherical linear interpolation of two matrices

Returns
The interpolated matrix

◆ transpose()

template<class Type >
void ARSTD::Matrix44< Type >::transpose ( )

Transposes the matrix

◆ transposeRot()

template<class Type >
void ARSTD::Matrix44< Type >::transposeRot ( )

Transposes the rotational part of the matrix only

Friends And Related Function Documentation

◆ equals()

template<class Type >
bool equals ( const Matrix44< Type > &  lhs,
const Matrix44< Type > &  rhs,
double  fEpsilon = EPSILON 
)
related

Compares two matrices with the epsilon given by the parameter fEpsilon

See also
EPSILON

◆ operator!=()

template<class Type >
bool operator!= ( const Matrix44< Type > &  lhs,
const Matrix44< Type > &  rhs 
)
related

Compares two matrices using default EPSILON

See also
EPSILON

◆ operator*() [1/3]

template<class Type >
const Matrix44< Type > operator* ( const Matrix44< Type > &  lhs,
const Matrix44< Type > &  rhs 
)
related

Matrix matrix multiplication

◆ operator*() [2/3]

template<class Type >
const Vector3< Type > operator* ( const Matrix44< Type > &  lhs,
const Vector3< Type > &  rhs 
)
related

Matrix vector multiplication assuming the 4th component of the vector to be 1

◆ operator*() [3/3]

template<class Type >
const Vector4< Type > operator* ( const Matrix44< Type > &  lhs,
const Vector4< Type > &  rhs 
)
related

Matrix vector multiplication

◆ operator<<()

template<class Type >
std::ostream & operator<< ( std::ostream &  stream,
const Matrix44< Type > &  mat 
)
related

Writes the matrix to a std output stream

◆ operator==()

template<class Type >
bool operator== ( const Matrix44< Type > &  lhs,
const Matrix44< Type > &  rhs 
)
related

Compares two matrices using default EPSILON

See also
EPSILON

◆ operator>>()

template<class Type >
std::istream & operator>> ( std::istream &  stream,
Matrix44< Type > &  mat 
)
related

Reads a matrix from a std input stream

Member Data Documentation

◆ IDENTITY

template<class Type >
const Matrix44<Type> ARSTD::Matrix44< Type >::IDENTITY
static

The identity matrix.


Generated at Sun Aug 7 2022 for project CodeSubWars. www.codesubwars.org