Kanzi 4.0.0-beta2
kanzi::Matrix3x3 Class Reference

Matrix with 3x3 elements. More...

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

Public Member Functions

constexpr Vector3 getColumn (size_t index) const
 Gets the column of a matrix.
 
float getRotationAngle () const
 Get rotation angle of the matrix.
 
constexpr Vector3 getRow (size_t index) const
 Gets the row of a matrix.
 
Vector2 getScale () const
 Get scale as a vector.
 
float getScaleX () const
 Get X scale component.
 
float getScaleY () const
 Get Y scale component.
 
constexpr Vector2 getTranslation () const
 Get translation.
 
constexpr float getTranslationX () const
 Get translation on X axis.
 
constexpr float getTranslationY () const
 Get translation on Y axis.
 
constexpr Vector2 getXAxis () const
 Get X axis.
 
constexpr Vector2 getYAxis () const
 Get Y axis.
 
constexpr Matrix3x3 ()
 Default constructor.
 
constexpr Matrix3x3 (float value)
 Constructor.
 
constexpr 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.
 
constexpr Matrix3x3 (Vector2 x, Vector2 y, Vector2 translation)
 Constructs the matrix from three column vectors.
 
constexpr Matrix3x3 (Vector3 x, Vector3 y, Vector3 translation)
 Constructs the matrix from three column vectors.
 
constexpr Matrix3x3operator*= (const Matrix3x3 &m)
 Modifies this matrix by multiplying it with another matrix.
 
constexpr Matrix3x3operator+= (const Matrix3x3 &m)
 Modifies this matrix by adding another matrix.
 
constexpr Matrix3x3operator-= (const Matrix3x3 &m)
 Modifies this matrix by subtracting another matrix from this matrix.
 
constexpr floatoperator[] (size_t index)
 Access to individual elements of the matrix.
 
constexpr const floatoperator[] (size_t index) const
 Access to individual elements of the matrix.
 
constexpr void scale (Vector2 v)
 Scales this matrix.
 
constexpr void setColumn (size_t index, Vector3 column)
 Sets the column of a matrix.
 
constexpr void setRow (size_t index, Vector3 row)
 Sets the row of a matrix.
 
constexpr void setTranslation (float translationX, float translationY)
 Set translation.
 
constexpr void setTranslation (Vector2 translation)
 Set translation.
 
constexpr void setTranslationX (float translationX)
 Set translation on X axis.
 
constexpr void setTranslationY (float translationY)
 Set translation on Y axis.
 
constexpr void setXAxis (Vector2 v)
 Set X axis.
 
constexpr void setYAxis (Vector2 v)
 Set Y axis.
 
constexpr void translate (Vector2 v)
 Translates this matrix.
 
constexpr Matrix3x3 transposed () const
 Applies a transpose to a matrix.
 

Static Public Member Functions

static constexpr Matrix3x3 createFilled (float value)
 Creates a matrix with all elements set to value.
 
static constexpr Matrix3x3 createIdentity ()
 Creates identity matrix.
 
static Matrix3x3 createRotationInDegrees (float angleInDegrees)
 Creates a rotation matrix.
 
static Matrix3x3 createRotationInRadians (float angleInRadians)
 Creates a rotation matrix.
 
static constexpr Matrix3x3 createScale (Vector2 scale)
 Creates a scaled matrix.
 
static Matrix3x3 createSRT (Vector2 scale, float rotationInRadians, Vector2 translation)
 Create an SRT matrix.
 
static constexpr Matrix3x3 createTranslation (float x, float y)
 Creates translation matrix.
 
static constexpr Matrix3x3 createTranslation (Vector2 translation)
 Creates translation matrix.
 

Detailed Description

Matrix with 3x3 elements.

Constructor & Destructor Documentation

◆ Matrix3x3() [1/5]

constexpr kanzi::Matrix3x3::Matrix3x3 ( )
inlineexplicitconstexpr

Default constructor.

Initializes the matrix to identity matrix.

◆ Matrix3x3() [2/5]

constexpr kanzi::Matrix3x3::Matrix3x3 ( float value)
inlineexplicitconstexpr

Constructor.

Initializes every component to the same value.

◆ Matrix3x3() [3/5]

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

Constructs the matrix from elements in column-major order.

Parameters
x0First column first component.
x1First column second component.
x2First column third component.
x3Second column first component.
x4Second column second component.
x5Second column third component.
x6Third column first component.
x7Third column second component.
x8Third column third component.

◆ Matrix3x3() [4/5]

constexpr kanzi::Matrix3x3::Matrix3x3 ( Vector2 x,
Vector2 y,
Vector2 translation )
inlineexplicitconstexpr

Constructs the matrix from three column vectors.

Parameters
xFirst column vector.
ySecond column vector.
translationTranslation vector.

◆ Matrix3x3() [5/5]

constexpr kanzi::Matrix3x3::Matrix3x3 ( Vector3 x,
Vector3 y,
Vector3 translation )
inlineexplicitconstexpr

Constructs the matrix from three column vectors.

Parameters
xFirst column vector.
ySecond column vector.
translationTranslation vector.

Member Function Documentation

◆ operator[]() [1/2]

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

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]

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

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

◆ getRow()

constexpr Vector3 kanzi::Matrix3x3::getRow ( size_t index) const
inlineconstexpr

Gets the row of a matrix.

Parameters
indexIndex of the accessed row.
Returns
The row.

◆ getColumn()

constexpr Vector3 kanzi::Matrix3x3::getColumn ( size_t index) const
inlineconstexpr

Gets the column of a matrix.

Parameters
indexIndex of the accessed column.
Returns
The column.

◆ setRow()

constexpr void kanzi::Matrix3x3::setRow ( size_t index,
Vector3 row )
inlineconstexpr

Sets the row of a matrix.

Parameters
indexIndex of the accessed row.
rowThe value to set to the row.

◆ setColumn()

constexpr void kanzi::Matrix3x3::setColumn ( size_t index,
Vector3 column )
inlineconstexpr

Sets the column of a matrix.

Parameters
indexIndex of the accessed column.
columnThe value to set to the column.

◆ getXAxis()

constexpr Vector2 kanzi::Matrix3x3::getXAxis ( ) const
inlineconstexpr

Get X axis.

◆ getYAxis()

constexpr Vector2 kanzi::Matrix3x3::getYAxis ( ) const
inlineconstexpr

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()

constexpr void kanzi::Matrix3x3::scale ( Vector2 v)
inlineconstexpr

Scales this matrix.

Parameters
vScaling vector.

◆ translate()

constexpr void kanzi::Matrix3x3::translate ( Vector2 v)
inlineconstexpr

Translates this matrix.

Parameters
vTranslation vector.

◆ setXAxis()

constexpr void kanzi::Matrix3x3::setXAxis ( Vector2 v)
inlineconstexpr

Set X axis.

Parameters
vX axis vector.

◆ setYAxis()

constexpr void kanzi::Matrix3x3::setYAxis ( Vector2 v)
inlineconstexpr

Set Y axis.

Parameters
vY axis vector.

◆ setTranslation() [1/2]

constexpr void kanzi::Matrix3x3::setTranslation ( Vector2 translation)
inlineconstexpr

Set translation.

Parameters
translationTranslation vector.

◆ setTranslation() [2/2]

constexpr void kanzi::Matrix3x3::setTranslation ( float translationX,
float translationY )
inlineconstexpr

Set translation.

Parameters
translationXTranslation X component.
translationYTranslation Y component.

◆ getTranslation()

constexpr Vector2 kanzi::Matrix3x3::getTranslation ( ) const
inlineconstexpr

Get translation.

Returns
Translation vector.

◆ getTranslationX()

constexpr float kanzi::Matrix3x3::getTranslationX ( ) const
inlineconstexpr

Get translation on X axis.

Returns
Translation X component.

◆ setTranslationX()

constexpr void kanzi::Matrix3x3::setTranslationX ( float translationX)
inlineconstexpr

Set translation on X axis.

Parameters
translationXTranslation X component.

◆ getTranslationY()

constexpr float kanzi::Matrix3x3::getTranslationY ( ) const
inlineconstexpr

Get translation on Y axis.

Returns
Translation Y component.

◆ setTranslationY()

constexpr void kanzi::Matrix3x3::setTranslationY ( float translationY)
inlineconstexpr

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+=()

constexpr Matrix3x3 & kanzi::Matrix3x3::operator+= ( const Matrix3x3 & m)
inlineconstexpr

Modifies this matrix by adding another matrix.

Parameters
mAnother matrix.
Returns
This matrix.

◆ operator-=()

constexpr Matrix3x3 & kanzi::Matrix3x3::operator-= ( const Matrix3x3 & m)
inlineconstexpr

Modifies this matrix by subtracting another matrix from this matrix.

Parameters
mAnother matrix.
Returns
This matrix.

◆ operator*=()

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

Modifies this matrix by multiplying it with another matrix.

Parameters
mAnother matrix.
Returns
This matrix.

◆ createTranslation() [1/2]

static constexpr Matrix3x3 kanzi::Matrix3x3::createTranslation ( Vector2 translation)
inlinestaticconstexpr

Creates translation matrix.

Parameters
translationTranslation vector.
Returns
Translation matrix.

◆ createTranslation() [2/2]

static constexpr Matrix3x3 kanzi::Matrix3x3::createTranslation ( float x,
float y )
inlinestaticconstexpr

Creates translation matrix.

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

◆ createScale()

static constexpr Matrix3x3 kanzi::Matrix3x3::createScale ( Vector2 scale)
inlinestaticconstexpr

Creates a scaled matrix.

Parameters
scaleScaling vector.
Returns
Scaled matrix.

◆ createIdentity()

static constexpr Matrix3x3 kanzi::Matrix3x3::createIdentity ( )
inlinestaticconstexpr

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.

◆ createFilled()

static constexpr Matrix3x3 kanzi::Matrix3x3::createFilled ( float value)
inlinestaticconstexpr

Creates a matrix with all elements set to value.

Parameters
valueValue to set to all elements.
Returns
The constructed matrix.
Since
Kanzi 3.9.9

◆ transposed()

constexpr Matrix3x3 kanzi::Matrix3x3::transposed ( ) const
inlineconstexpr

Applies a transpose to a matrix.

Returns
Newly constructed transpose matrix.

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