Searching...
No Matches
MATRIX3x3< T > Class Template Reference

MATRIX3x3 describes a general 3x3 matrix. More...

`#include <matrix3x3.h>`

## Public Member Functions

MATRIX3x3 ()
Initialize all matrix members to zero.

MATRIX3x3 (VECTOR3< T > a1, VECTOR3< T > a2, VECTOR3< T > a3)
Initialize with 3 vectors.

MATRIX3x3 (T a00, T a01, T a02, T a10, T a11, T a12, T a20, T a21, T a22)
Initialize with given matrix members.

void SetIdentity ()
Set the matrix to the identity matrix.

void SetTranslation (VECTOR2< T > aTranslation)
Set the translation components of the matrix.

VECTOR2< T > GetTranslation () const
Get the translation components of the matrix.

void SetRotation (T aAngle)
Set the rotation components of the matrix.

void SetScale (VECTOR2< T > aScale)
Set the scale components of the matrix.

VECTOR2< T > GetScale () const
Get the scale components of the matrix.

Determinant () const
Compute the determinant of the matrix.

MATRIX3x3 Inverse () const
Determine the inverse of the matrix.

MATRIX3x3 Transpose () const
Get the transpose of the matrix.

bool operator== (const MATRIX3x3< T > &aOtherMatrix) const
Not equality operator.

bool operator!= (const MATRIX3x3< T > &aOtherMatrix) const

m_data [3][3]

## Friends

std::ostream & operator (std::ostream &aStream, const MATRIX3x3< T > &aMatrix)
Output to a stream.

## Detailed Description

template<class T>
class MATRIX3x3< T >

MATRIX3x3 describes a general 3x3 matrix.

Any linear transformation in 2D can be represented by a homogeneous 3x3 transformation matrix. Given a vector x, the linear transformation with the transformation matrix M is given as

x' = M * x

To represent an affine transformation, homogeneous coordinates have to be used. That means the 2D-vector (x, y) has to be extended to a 3D-vector by a third component (x, y, 1).

Transformations can be easily combined by matrix multiplication.

A * (B * x ) = (A * B) * x ( A, B: transformation matrices, x: vector )

This class was implemented using templates, so flexible type combinations are possible.

Definition at line 62 of file matrix3x3.h.

## ◆ MATRIX3x3() [1/3]

template<class T >
 MATRIX3x3< T >::MATRIX3x3

Initialize all matrix members to zero.

Definition at line 193 of file matrix3x3.h.

## ◆ MATRIX3x3() [2/3]

template<class T >
 MATRIX3x3< T >::MATRIX3x3 ( VECTOR3< T > a1, VECTOR3< T > a2, VECTOR3< T > a3 )

Initialize with 3 vectors.

Definition at line 206 of file matrix3x3.h.

References VECTOR3< T >::x, VECTOR3< T >::y, and VECTOR3< T >::z.

## ◆ MATRIX3x3() [3/3]

template<class T >
 MATRIX3x3< T >::MATRIX3x3 ( T a00, T a01, T a02, T a10, T a11, T a12, T a20, T a21, T a22 )

Initialize with given matrix members.

Parameters
 a00 is the component [0,0]. a01 is the component [0,1]. a02 is the component [0,2]. a10 is the component [1,0]. a11 is the component [1,1]. a12 is the component [1,2]. a20 is the component [2,0]. a21 is the component [2,1]. a22 is the component [2,2].

Definition at line 223 of file matrix3x3.h.

## ◆ Determinant()

template<class T >
 T MATRIX3x3< T >::Determinant

Compute the determinant of the matrix.

Returns
the determinant value.

Definition at line 351 of file matrix3x3.h.

## ◆ GetScale()

template<class T >
 VECTOR2< T > MATRIX3x3< T >::GetScale

Get the scale components of the matrix.

Returns
the scale factors, specified as 2D-vector.

Definition at line 295 of file matrix3x3.h.

## ◆ GetTranslation()

template<class T >
 VECTOR2< T > MATRIX3x3< T >::GetTranslation

Get the translation components of the matrix.

Returns
is the translation (2D-vector).

Definition at line 264 of file matrix3x3.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

## ◆ Inverse()

template<class T >
 MATRIX3x3< T > MATRIX3x3< T >::Inverse

Determine the inverse of the matrix.

The inverse of a transformation matrix can be used to revert a transformation.

x = Minv * ( M * x ) ( M: transformation matrix, Minv: inverse transformation matrix, x: vector)

Returns
the inverse matrix.

Definition at line 384 of file matrix3x3.h.

References MATRIX3x3< T >::m_data.

## ◆ operator!=()

template<class T >
 bool MATRIX3x3< T >::operator!= ( const MATRIX3x3< T > & aOtherMatrix ) const

Definition at line 458 of file matrix3x3.h.

References MATRIX3x3< T >::m_data.

## ◆ operator==()

template<class T >
 bool MATRIX3x3< T >::operator== ( const MATRIX3x3< T > & aOtherMatrix ) const

Not equality operator.

Definition at line 443 of file matrix3x3.h.

References MATRIX3x3< T >::m_data.

## ◆ SetIdentity()

template<class T >
 void MATRIX3x3< T >::SetIdentity ( void )

Set the matrix to the identity matrix.

The diagonal components of the matrix are set to 1.

Definition at line 240 of file matrix3x3.h.

## ◆ SetRotation()

template<class T >
 void MATRIX3x3< T >::SetRotation ( T aAngle )

Set the rotation components of the matrix.

The angle needs to have a positive value for an anti-clockwise rotation.

Parameters
 aAngle is the rotation angle in [rad].

Definition at line 275 of file matrix3x3.h.

## ◆ SetScale()

template<class T >
 void MATRIX3x3< T >::SetScale ( VECTOR2< T > aScale )

Set the scale components of the matrix.

Parameters
 aScale contains the scale factors, specified as 2D-vector.

Definition at line 287 of file matrix3x3.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

## ◆ SetTranslation()

template<class T >
 void MATRIX3x3< T >::SetTranslation ( VECTOR2< T > aTranslation )

Set the translation components of the matrix.

Parameters
 aTranslation is the translation, specified as 2D-vector.

Definition at line 256 of file matrix3x3.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

## ◆ Transpose()

template<class T >
 MATRIX3x3< T > MATRIX3x3< T >::Transpose

Get the transpose of the matrix.

Returns
the transpose matrix.

Definition at line 405 of file matrix3x3.h.

References MATRIX3x3< T >::m_data.

## ◆ operator

template<class T >
 std::ostream & operator ( std::ostream & aStream, const MATRIX3x3< T > & aMatrix )
friend

Output to a stream.

Equality operator

## ◆ m_data

template<class T >
 T MATRIX3x3< T >::m_data[3][3]

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