![]() |
KiCad PCB EDA Suite
|
MATRIX3x3 describes a general 3x3 matrix. More...
#include <matrix3x3.h>
Public Member Functions | |
MATRIX3x3 () | |
Constructor. More... | |
MATRIX3x3 (T a00, T a01, T a02, T a10, T a11, T a12, T a20, T a21, T a22) | |
Constructor. More... | |
void | SetIdentity () |
Set the matrix to the identity matrix. More... | |
void | SetTranslation (VECTOR2< T > aTranslation) |
Set the translation components of the matrix. More... | |
VECTOR2< T > | GetTranslation () const |
Get the translation components of the matrix. More... | |
void | SetRotation (T aAngle) |
Set the rotation components of the matrix. More... | |
void | SetScale (VECTOR2< T > aScale) |
Set the scale components of the matrix. More... | |
VECTOR2< T > | GetScale () const |
Get the scale components of the matrix. More... | |
T | Determinant () const |
Compute the determinant of the matrix. More... | |
MATRIX3x3 | Inverse () const |
Determine the inverse of the matrix. More... | |
MATRIX3x3 | Transpose () const |
Get the transpose of the matrix. More... | |
Public Attributes | |
T | m_data [3][3] |
Friends | |
std::ostream & | operator (std::ostream &aStream, const MATRIX3x3< T > &aMatrix) |
Output to a stream. More... | |
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 55 of file matrix3x3.h.
MATRIX3x3< T >::MATRIX3x3 | ( | T | a00, |
T | a01, | ||
T | a02, | ||
T | a10, | ||
T | a11, | ||
T | a12, | ||
T | a20, | ||
T | a21, | ||
T | a22 | ||
) |
Constructor.
Initialize with given matrix members
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 197 of file matrix3x3.h.
T MATRIX3x3< T >::Determinant | ( | ) | const |
Compute the determinant of the matrix.
Definition at line 310 of file matrix3x3.h.
Get the scale components of the matrix.
Definition at line 269 of file matrix3x3.h.
Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::getShadowWidth(), KIGFX::VIEW::ToScreen(), and KIGFX::VIEW::ToWorld().
Get the translation components of the matrix.
Definition at line 238 of file matrix3x3.h.
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)
Definition at line 343 of file matrix3x3.h.
Referenced by KIGFX::CAIRO_PRINT_GAL::ComputeWorldScreenMatrix(), and KIGFX::GAL::ComputeWorldScreenMatrix().
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 214 of file matrix3x3.h.
Referenced by KIGFX::CAIRO_PRINT_GAL::ComputeWorldScreenMatrix(), and KIGFX::GAL::ComputeWorldScreenMatrix().
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.
aAngle | is the rotation angle in [rad]. |
Definition at line 249 of file matrix3x3.h.
Referenced by KIGFX::CAIRO_PRINT_GAL::ComputeWorldScreenMatrix(), and KIGFX::GAL::ComputeWorldScreenMatrix().
Set the scale components of the matrix.
aScale | contains the scale factors, specified as 2D-vector. |
Definition at line 261 of file matrix3x3.h.
Referenced by KIGFX::CAIRO_PRINT_GAL::ComputeWorldScreenMatrix(), and KIGFX::GAL::ComputeWorldScreenMatrix().
Set the translation components of the matrix.
aTranslation | is the translation, specified as 2D-vector. |
Definition at line 230 of file matrix3x3.h.
Referenced by KIGFX::CAIRO_PRINT_GAL::ComputeWorldScreenMatrix(), and KIGFX::GAL::ComputeWorldScreenMatrix().
Get the transpose of the matrix.
Definition at line 364 of file matrix3x3.h.
|
friend |
Output to a stream.
T MATRIX3x3< T >::m_data[3][3] |
Definition at line 64 of file matrix3x3.h.
Referenced by KIGFX::OPENGL_GAL::beginDrawing(), MATRIX3x3< double >::Inverse(), operator *(), operator<<(), KIGFX::CAIRO_GAL_BASE::resetContext(), KIGFX::CAIRO_GAL_BASE::Transform(), KIGFX::OPENGL_GAL::Transform(), and MATRIX3x3< double >::Transpose().