Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::Matrix3x3 Class Reference

Matrix with 3x3 elements. More...

#include <kanzi/core/math/matrix3x3.hpp>

Public Member Functions

float getRotationAngle () const
 Get rotation angle of the matrix. More...
 
Vector2 getScale () const
 Get scale as a vector. More...
 
float getScaleX () const
 Get X scale component. More...
 
float getScaleY () const
 Get Y scale component. More...
 
Vector2 getTranslation () const
 Get translation. More...
 
float getTranslationX () const
 Get translation on X axis. More...
 
float getTranslationY () const
 Get translation on Y axis. More...
 
Vector2 getXAxis () const
 Get X axis. More...
 
Vector2 getYAxis () const
 Get Y axis. More...
 
 Matrix3x3 ()
 Default constructor, initializes the matrix to identity matrix. More...
 
 Matrix3x3 (float x0, float x1, float x2, float x3, float x4, float x5, float x6, float x7, float x8)
 Constructs the matrix from elements in column-major order. More...
 
 Matrix3x3 (const Vector2 &x, const Vector2 &y, const Vector2 &translation)
 Constructs the matrix from three column vectors. More...
 
Matrix3x3operator*= (const Matrix3x3 &m)
 Modifies this matrix by multiplying it with another matrix. More...
 
Matrix3x3operator+= (const Matrix3x3 &m)
 Modifies this matrix by adding another matrix. More...
 
Matrix3x3operator-= (const Matrix3x3 &m)
 Modifies this matrix by subtracting another matrix from this matrix. More...
 
const float & operator[] (size_t index) const
 Access to individual elements of the matrix. More...
 
float & operator[] (size_t index)
 Access to individual elements of the matrix. More...
 
void scale (const Vector2 &v)
 Scales this matrix. More...
 
void setTranslation (Vector2 translation)
 Set translation. More...
 
void setTranslation (float translationX, float translationY)
 Set translation. More...
 
void setTranslationX (float translationX)
 Set translation on X axis. More...
 
void setTranslationY (float translationY)
 Set translation on Y axis. More...
 
void setXAxis (Vector2 v)
 Set X axis. More...
 
void setYAxis (Vector2 v)
 Set Y axis. More...
 
void translate (const Vector2 &v)
 Translates this matrix. More...
 
Matrix3x3 transposed () const
 Applies a transpose to a matrix. More...
 

Static Public Member Functions

static Matrix3x3 createIdentity ()
 Creates identity matrix. More...
 
static Matrix3x3 createRotationInDegrees (float angleInDegrees)
 Creates a rotation matrix. More...
 
static Matrix3x3 createRotationInRadians (float angleInRadians)
 Creates a rotation matrix. More...
 
static Matrix3x3 createScale (Vector2 scale)
 Creates a scaled matrix. More...
 
static Matrix3x3 createSRT (Vector2 scale, float rotationInRadians, Vector2 translation)
 Create an SRT matrix. More...
 
static Matrix3x3 createTranslation (Vector2 translation)
 Creates translation matrix. More...
 
static Matrix3x3 createTranslation (float x, float y)
 Creates translation matrix. More...
 

Friends

Matrix3x3 operator+ (Matrix3x3 lhs, const Matrix3x3 &rhs)
 Creates a new matrix by adding an existing matrix to another one. More...
 
Matrix3x3 operator- (Matrix3x3 lhs, const Matrix3x3 &rhs)
 Creates a new matrix by subtracting an existing matrix from another one. More...
 

Detailed Description

Matrix with 3x3 elements.

Constructor & Destructor Documentation

◆ Matrix3x3() [1/3]

kanzi::Matrix3x3::Matrix3x3 ( )
inlineexplicit

Default constructor, initializes the matrix to identity matrix.

◆ Matrix3x3() [2/3]

kanzi::Matrix3x3::Matrix3x3 ( float  x0,
float  x1,
float  x2,
float  x3,
float  x4,
float  x5,
float  x6,
float  x7,
float  x8 
)
inlineexplicit

Constructs the matrix from elements in column-major order.

◆ Matrix3x3() [3/3]

kanzi::Matrix3x3::Matrix3x3 ( const Vector2 x,
const Vector2 y,
const Vector2 translation 
)
inlineexplicit

Constructs the matrix from three column vectors.

Member Function Documentation

◆ operator[]() [1/2]

const float& kanzi::Matrix3x3::operator[] ( size_t  index) const
inline

Access to individual elements of the matrix.

Elements are stored in column-major order.

Parameters
indexIndex of the accessed element. Possible values are numbers from 0 to 8.
Returns

◆ operator[]() [2/2]

float& kanzi::Matrix3x3::operator[] ( size_t  index)
inline

Access to individual elements of the matrix.

Elements are stored in column-major order.

Parameters
indexIndex of the accessed element. Possible values are numbers from 0 to 8.
Returns

◆ getXAxis()

Vector2 kanzi::Matrix3x3::getXAxis ( ) const
inline

Get X axis.

◆ getYAxis()

Vector2 kanzi::Matrix3x3::getYAxis ( ) const
inline

Get Y axis.

◆ getScaleX()

float kanzi::Matrix3x3::getScaleX ( ) const
inline

Get X scale component.

◆ getScaleY()

float kanzi::Matrix3x3::getScaleY ( ) const
inline

Get Y scale component.

◆ getScale()

Vector2 kanzi::Matrix3x3::getScale ( ) const
inline

Get scale as a vector.

◆ scale()

void kanzi::Matrix3x3::scale ( const Vector2 v)
inline

Scales this matrix.

Parameters
vScaling vector.

◆ translate()

void kanzi::Matrix3x3::translate ( const Vector2 v)
inline

Translates this matrix.

Parameters
vTranslation vector.

◆ setXAxis()

void kanzi::Matrix3x3::setXAxis ( Vector2  v)
inline

Set X axis.

Parameters
vX axis vector.

◆ setYAxis()

void kanzi::Matrix3x3::setYAxis ( Vector2  v)
inline

Set Y axis.

Parameters
vY axis vector.

◆ setTranslation() [1/2]

void kanzi::Matrix3x3::setTranslation ( Vector2  translation)
inline

Set translation.

Parameters
translationTranslation vector.

◆ setTranslation() [2/2]

void kanzi::Matrix3x3::setTranslation ( float  translationX,
float  translationY 
)
inline

Set translation.

Parameters
translationXTranslation X component.
translationYTranslation Y component.

◆ getTranslation()

Vector2 kanzi::Matrix3x3::getTranslation ( ) const
inline

Get translation.

Returns
Translation vector.

◆ getTranslationX()

float kanzi::Matrix3x3::getTranslationX ( ) const
inline

Get translation on X axis.

Returns
Translation X component.

◆ setTranslationX()

void kanzi::Matrix3x3::setTranslationX ( float  translationX)
inline

Set translation on X axis.

Parameters
translationXTranslation X component.

◆ getTranslationY()

float kanzi::Matrix3x3::getTranslationY ( ) const
inline

Get translation on Y axis.

Returns
Translation Y component.

◆ setTranslationY()

void kanzi::Matrix3x3::setTranslationY ( float  translationY)
inline

Set translation on Y axis.

Parameters
translationYTranslation Y component.

◆ getRotationAngle()

float kanzi::Matrix3x3::getRotationAngle ( ) const

Get rotation angle of the matrix.

Returns
Rotation angle of the matrix.

◆ operator+=()

Matrix3x3& kanzi::Matrix3x3::operator+= ( const Matrix3x3 m)
inline

Modifies this matrix by adding another matrix.

Parameters
mAnother matrix.
Returns
This matrix.

◆ operator-=()

Matrix3x3& kanzi::Matrix3x3::operator-= ( const Matrix3x3 m)
inline

Modifies this matrix by subtracting another matrix from this matrix.

Parameters
mAnother matrix.
Returns
This matrix.

◆ operator*=()

Matrix3x3& kanzi::Matrix3x3::operator*= ( const Matrix3x3 m)

Modifies this matrix by multiplying it with another matrix.

Parameters
mAnother matrix.
Returns
This matrix.

◆ createTranslation() [1/2]

static Matrix3x3 kanzi::Matrix3x3::createTranslation ( Vector2  translation)
inlinestatic

Creates translation matrix.

Parameters
translationTranslation vector.
Returns
Translation matrix.

◆ createTranslation() [2/2]

static Matrix3x3 kanzi::Matrix3x3::createTranslation ( float  x,
float  y 
)
inlinestatic

Creates translation matrix.

Parameters
xX component of the Translation vector.
yY component of the Translation vector.
Returns
Translation matrix.

◆ createScale()

static Matrix3x3 kanzi::Matrix3x3::createScale ( Vector2  scale)
inlinestatic

Creates a scaled matrix.

Parameters
scaleScaling vector.
Returns
Scaled matrix.

◆ createIdentity()

static Matrix3x3 kanzi::Matrix3x3::createIdentity ( )
inlinestatic

Creates identity matrix.

Returns
Identity matrix.

◆ createRotationInDegrees()

static Matrix3x3 kanzi::Matrix3x3::createRotationInDegrees ( float  angleInDegrees)
static

Creates a rotation matrix.

Parameters
angleInDegreesRotation angle in degrees.
Returns
Rotation matrix.

◆ createRotationInRadians()

static Matrix3x3 kanzi::Matrix3x3::createRotationInRadians ( float  angleInRadians)
static

Creates a rotation matrix.

Parameters
angleInRadiansRotation angle in radians.
Returns
Rotation matrix.

◆ createSRT()

static Matrix3x3 kanzi::Matrix3x3::createSRT ( Vector2  scale,
float  rotationInRadians,
Vector2  translation 
)
static

Create an SRT matrix.

Parameters
scaleScales by axises.
rotationInRadiansRotation component in radians.
translationTranslation component.
Returns
Newly constructed matrix.

◆ transposed()

Matrix3x3 kanzi::Matrix3x3::transposed ( ) const
inline

Applies a transpose to a matrix.

Returns
Newly constructed transpose matrix.

Friends And Related Function Documentation

◆ operator+

Matrix3x3 operator+ ( Matrix3x3  lhs,
const Matrix3x3 rhs 
)
friend

Creates a new matrix by adding an existing matrix to another one.

Parameters
lhsFirst matrix, left hand side.
rhsSecond matrix, right hand side.
Returns
A new matrix resulting from the addition of the right hand side to the left hand side.

◆ operator-

Matrix3x3 operator- ( Matrix3x3  lhs,
const Matrix3x3 rhs 
)
friend

Creates a new matrix by subtracting an existing matrix from another one.

Parameters
lhsFirst matrix, left hand side.
rhsSecond matrix, right hand side.
Returns
A new matrix resulting from the subtraction of the right hand side to the left hand side.

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