Base Framework
Public Member Functions | Static Public Member Functions | Protected Attributes | Related Functions | List of all members
Matrix4x4< TYPE > Class Template Reference

4 by 4 matrix. More...

#include <base/math/Matrix4x4.h>

Public Member Functions

 Matrix4x4 () noexcept
 
 Matrix4x4 (const Matrix4x4 &_copy) noexcept
 
Matrix4x4operator= (const Matrix4x4 &assign) noexcept
 
TYPE getAt (unsigned int row, unsigned int column) const noexcept
 
void setAt (unsigned int row, unsigned int column, const TYPE &value) noexcept
 
TYPE * getElements () noexcept
 
const TYPE * getElements () const noexcept
 
bool isEqual (const Matrix4x4 &value) const noexcept
 
bool isZero () const noexcept
 
bool isDiagonal () const noexcept
 
bool isSymmetric () const noexcept
 
TYPE getL1Norm () const noexcept
 
TYPE getSquareHSNorm () const noexcept
 
TYPE getInfinityNorm () const noexcept
 
TYPE getDeterminant () const noexcept
 
Matrix4x4inverse (const Matrix4x4 &value) noexcept
 
Matrix4x4inverse () noexcept
 
Matrix4x4 plus () const noexcept
 
Matrix4x4 minus () const noexcept
 
Matrix4x4 negate () noexcept
 
Matrix4x4add (const Matrix4x4 &value) noexcept
 
Matrix4x4subtract (const Matrix4x4 &value) noexcept
 
Matrix4x4multiply (const TYPE &value) noexcept
 
Quaternion< TYPE > multiply (const Quaternion< TYPE > &value) noexcept
 
Matrix4x4 multiply (const Matrix4x4 &value) noexcept
 
TYPE deviationFromZero () const noexcept
 
TYPE deviationFromIdentity () const noexcept
 
void forceHomogeneous () noexcept
 
Matrix4x4divide (const TYPE &value) noexcept
 
Matrix4x4transpose () noexcept
 
Matrix4x4transpose (const Matrix4x4 &value) noexcept
 
bool operator== (const Matrix4x4 &value) const noexcept
 
Matrix4x4operator+= (const Matrix4x4 &value) noexcept
 
Matrix4x4operator-= (const Matrix4x4 &value) noexcept
 
Matrix4x4operator*= (const TYPE &value) noexcept
 
Matrix4x4operator/= (const TYPE &value) noexcept
 
Matrix4x4 operator+ () const noexcept
 
Matrix4x4 operator- () const noexcept
 

Static Public Member Functions

static Matrix4x4 getXRotation (TYPE angle) noexcept
 
static Matrix4x4 getYRotation (TYPE angle) noexcept
 
static Matrix4x4 getZRotation (TYPE angle) noexcept
 
static Matrix4x4 getXYZRotation (const Vector3D< TYPE > rotation) noexcept
 
static Matrix4x4 getQRotation (const Quaternion< TYPE > &quaternion) noexcept
 

Protected Attributes

TYPE elements [4][4]
 

Related Functions

(Note that these are not member functions.)

template<class TYPE >
Matrix4x4< TYPE > operator+ (const Matrix4x4< TYPE > &left, const Matrix4x4< TYPE > &right) noexcept
 
template<class TYPE >
Matrix4x4< TYPE > operator- (const Matrix4x4< TYPE > &left, const Matrix4x4< TYPE > &right) noexcept
 
template<class TYPE >
Matrix4x4< TYPE > operator* (const Matrix4x4< TYPE > &left, const TYPE &right) noexcept
 
template<class TYPE >
Matrix4x4< TYPE > operator* (const TYPE &left, const Matrix4x4< TYPE > &right) noexcept
 
template<class TYPE >
Matrix4x4< TYPE > operator* (const Matrix4x4< TYPE > &left, const Matrix4x4< TYPE > &right) noexcept
 
template<class TYPE >
Matrix4x4< TYPE > operator/ (const Matrix4x4< TYPE > &left, const TYPE &right) noexcept
 
template<class TYPE >
FormatOutputStreamoperator<< (FormatOutputStream &stream, const Matrix4x4< TYPE > &value)
 
template<class TYPE >
Quaternion< TYPE > operator* (const Matrix4x4< TYPE > &left, const Quaternion< TYPE > &right) noexcept
 

Detailed Description

template<class TYPE>
class Matrix4x4< TYPE >

4 by 4 matrix.

A 4 by 4 matrix with elements storage organized in row major and column minor.

Version
1.0

Constructor & Destructor Documentation

◆ Matrix4x4() [1/2]

template<class TYPE >
Matrix4x4< TYPE >::Matrix4x4 ( )
inlinenoexcept

Construct an unitialized matrix.

◆ Matrix4x4() [2/2]

template<class TYPE >
Matrix4x4< TYPE >::Matrix4x4 ( const Matrix4x4< TYPE > &  _copy)
inlinenoexcept

Initializes matrix by copying from other matrix.

Member Function Documentation

◆ add()

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::add ( const Matrix4x4< TYPE > &  value)
inlinenoexcept

Adds the specified vector to this vector.

◆ deviationFromIdentity()

template<class TYPE >
TYPE Matrix4x4< TYPE >::deviationFromIdentity ( ) const
inlinenoexcept

Returns an estimate for the deviation from the identity matrix. The estimate is calulated as the sum of all elements of the L1-norm of the difference between this matrix and the identity matrix.

◆ deviationFromZero()

template<class TYPE >
TYPE Matrix4x4< TYPE >::deviationFromZero ( ) const
inlinenoexcept

Returns an estimate for the deviation from the zero matrix. The estimate is calculated as the sum of all elements of the L1-norm.

◆ divide()

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::divide ( const TYPE &  value)
inlinenoexcept

Divides this matrix elements with the specified value.

◆ forceHomogeneous()

template<class TYPE >
void Matrix4x4< TYPE >::forceHomogeneous ( )
inlinenoexcept

Fills the last row with the vector [0 0 0 1] and leaves the other elements unchanged.

◆ getAt()

template<class TYPE >
TYPE Matrix4x4< TYPE >::getAt ( unsigned int  row,
unsigned int  column 
) const
inlinenoexcept

Returns the item at the given position.

◆ getDeterminant()

template<class TYPE >
TYPE Matrix4x4< TYPE >::getDeterminant ( ) const
inlinenoexcept

Returns the determinant of the matrix.

◆ getInfinityNorm()

template<class TYPE >
TYPE Matrix4x4< TYPE >::getInfinityNorm ( ) const
inlinenoexcept

Returns the infinity norm of the matrix.

◆ getL1Norm()

template<class TYPE >
TYPE Matrix4x4< TYPE >::getL1Norm ( ) const
inlinenoexcept

Returns the L1-norm of the matrix.

◆ getQRotation()

template<class TYPE >
static Matrix4x4 Matrix4x4< TYPE >::getQRotation ( const Quaternion< TYPE > &  quaternion)
inlinestaticnoexcept

Returns a homogeneous rotation matrix corresponding to the specified quaternion.

◆ getSquareHSNorm()

template<class TYPE >
TYPE Matrix4x4< TYPE >::getSquareHSNorm ( ) const
inlinenoexcept

Returns the square of the Hilbert-Schmidt norm of the matrix.

◆ getXRotation()

template<class TYPE >
static Matrix4x4 Matrix4x4< TYPE >::getXRotation ( TYPE  angle)
inlinestaticnoexcept

Returns a homogeneous rotation matrix corresponding to the specified angle of rotation (in radians) around the X-axis.

◆ getXYZRotation()

template<class TYPE >
static Matrix4x4 Matrix4x4< TYPE >::getXYZRotation ( const Vector3D< TYPE >  rotation)
inlinestaticnoexcept

Returns a homogeneous rotation matrix corresponding to the specified Euler angles.

◆ getYRotation()

template<class TYPE >
static Matrix4x4 Matrix4x4< TYPE >::getYRotation ( TYPE  angle)
inlinestaticnoexcept

Returns a homogeneous rotation matrix corresponding to the specified angle of rotation (in radians) around the Y-axis.

◆ getZRotation()

template<class TYPE >
static Matrix4x4 Matrix4x4< TYPE >::getZRotation ( TYPE  angle)
inlinestaticnoexcept

Returns a homogeneous rotation matrix corresponding to the specified angle of rotation (in radians) around the Z-axis.

◆ inverse() [1/2]

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::inverse ( )
inlinenoexcept

Inverses the matrix.

◆ inverse() [2/2]

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::inverse ( const Matrix4x4< TYPE > &  value)
inlinenoexcept

Inverses the specified matrix.

◆ isZero()

template<class TYPE >
bool Matrix4x4< TYPE >::isZero ( ) const
inlinenoexcept

Returns true if the length of this vector is zero.

◆ minus()

template<class TYPE >
Matrix4x4 Matrix4x4< TYPE >::minus ( ) const
inlinenoexcept

Unary minus.

◆ multiply() [1/3]

template<class TYPE >
Matrix4x4 Matrix4x4< TYPE >::multiply ( const Matrix4x4< TYPE > &  value)
inlinenoexcept

Multiplies the matrix elements with the specified matrix.

◆ multiply() [2/3]

template<class TYPE >
Quaternion<TYPE> Matrix4x4< TYPE >::multiply ( const Quaternion< TYPE > &  value)
inlinenoexcept

Multiplies the matrix with the specified quaternion.

◆ multiply() [3/3]

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::multiply ( const TYPE &  value)
inlinenoexcept

Multiplies the matrix elements with the specified value.

◆ negate()

template<class TYPE >
Matrix4x4 Matrix4x4< TYPE >::negate ( )
inlinenoexcept

Negates the quaternion.

◆ operator*=()

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::operator*= ( const TYPE &  value)
inlinenoexcept

Multiplies this vector with the specified value.

Parameters
valueThe multiplicator.

◆ operator+()

template<class TYPE >
Matrix4x4 Matrix4x4< TYPE >::operator+ ( ) const
inlinenoexcept

Unary plus.

◆ operator+=()

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::operator+= ( const Matrix4x4< TYPE > &  value)
inlinenoexcept

Adds the specified vector from this vector.

Parameters
valueThe value to be added.

◆ operator-()

template<class TYPE >
Matrix4x4 Matrix4x4< TYPE >::operator- ( ) const
inlinenoexcept

Unary minus.

◆ operator-=()

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::operator-= ( const Matrix4x4< TYPE > &  value)
inlinenoexcept

Subtracts the specified vector from this vector.

Parameters
valueThe value to be subtracted.

◆ operator/=()

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::operator/= ( const TYPE &  value)
inlinenoexcept

Divides this vector with the specified value.

Parameters
valueThe divisor.

◆ operator=()

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::operator= ( const Matrix4x4< TYPE > &  assign)
inlinenoexcept

Assignment of matrix to matrix.

◆ operator==()

template<class TYPE >
bool Matrix4x4< TYPE >::operator== ( const Matrix4x4< TYPE > &  value) const
inlinenoexcept

Returns true if the vectors are equal.

Parameters
vectorVector to be compared.

◆ plus()

template<class TYPE >
Matrix4x4 Matrix4x4< TYPE >::plus ( ) const
inlinenoexcept

Unary plus.

◆ setAt()

template<class TYPE >
void Matrix4x4< TYPE >::setAt ( unsigned int  row,
unsigned int  column,
const TYPE &  value 
)
inlinenoexcept

Sets the items at the given position.

◆ subtract()

template<class TYPE >
Matrix4x4& Matrix4x4< TYPE >::subtract ( const Matrix4x4< TYPE > &  value)
inlinenoexcept

Subtracts the specified vector from this vector.

Friends And Related Function Documentation

◆ operator*() [1/4]

template<class TYPE >
Matrix4x4< TYPE > operator* ( const Matrix4x4< TYPE > &  left,
const Matrix4x4< TYPE > &  right 
)
related

Returns the product of the matrices.

◆ operator*() [2/4]

template<class TYPE >
Quaternion< TYPE > operator* ( const Matrix4x4< TYPE > &  left,
const Quaternion< TYPE > &  right 
)
related

Returns the product of the matrix and quaternion.

◆ operator*() [3/4]

template<class TYPE >
Matrix4x4< TYPE > operator* ( const Matrix4x4< TYPE > &  left,
const TYPE &  right 
)
related

Returns the product of the matrix and the value.

◆ operator*() [4/4]

template<class TYPE >
Matrix4x4< TYPE > operator* ( const TYPE &  left,
const Matrix4x4< TYPE > &  right 
)
related

Returns the product of the matrix and the value.

◆ operator+()

template<class TYPE >
Matrix4x4< TYPE > operator+ ( const Matrix4x4< TYPE > &  left,
const Matrix4x4< TYPE > &  right 
)
related

Returns the sum of the vectors.

◆ operator-()

template<class TYPE >
Matrix4x4< TYPE > operator- ( const Matrix4x4< TYPE > &  left,
const Matrix4x4< TYPE > &  right 
)
related

Returns the difference of the vectors.

◆ operator/()

template<class TYPE >
Matrix4x4< TYPE > operator/ ( const Matrix4x4< TYPE > &  left,
const TYPE &  right 
)
related

Returns the result of the vector divided by the value.

◆ operator<<()

template<class TYPE >
FormatOutputStream & operator<< ( FormatOutputStream stream,
const Matrix4x4< TYPE > &  value 
)
related

Writes a string representation of a Matrix4x4 object to a format stream.

Member Data Documentation

◆ elements

template<class TYPE >
TYPE Matrix4x4< TYPE >::elements[4][4]
protected

The elements of the matrix (row by column).