kanzi::Matrix4x4 Class Reference

Matrix with 4x4 elements. More...

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

Public Member Functions

 Matrix4x4 ()
 Default constructor, initializes the matrix to identity matrix. More...
 
 Matrix4x4 (float x0, float x1, float x2, float x3, float x4, float x5, float x6, float x7, float x8, float x9, float x10, float x11, float x12, float x13, float x14, float x15)
 Constructs the matrix from elements. More...
 
 Matrix4x4 (const Vector3 &x, const Vector3 &y, const Vector3 &z, const Vector3 &translation)
 Constructs the matrix from 4 vectors. 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...
 
Vector3 getXAxis () const
 
Vector3 getYAxis () const
 
Vector3 getZAxis () const
 
Vector3 getTranslation () const
 
Vector3 getScale () const
 
void scale (const Vector3 &scale)
 
void setXAxis (Vector3 v)
 
void setYAxis (Vector3 v)
 
void setZAxis (Vector3 v)
 
void setTranslation (Vector3 translation)
 
float getTranslationX () const
 Get translation on X axis. More...
 
void setTranslationX (float translationX)
 Set translation on X axis. More...
 
float getTranslationY () const
 Get translation on Y axis. More...
 
void setTranslationY (float translationY)
 Set translation on Y axis. More...
 
float getTranslationZ () const
 Get translation on Z axis. More...
 
void setTranslationZ (float translationZ)
 Set translation on Z axis. More...
 
Matrix4x4operator+= (const Matrix4x4 &v)
 Modifies this matrix by adding another matrix. More...
 
Matrix4x4operator-= (const Matrix4x4 &v)
 Modifies this matrix by subtracting another matrix from this matrix. More...
 
Vector3 operator* (const Vector3 &vector) const
 Multiply a 3-component vector with this matrix. More...
 
Vector4 operator* (const Vector4 &vector) const
 Multiply a 4-component vector with this matrix. More...
 
Matrix4x4operator*= (const Matrix4x4 &m)
 Modifies this matrix by multiplying it with another matrix. More...
 
Matrix4x4 transposed () const
 

Static Public Member Functions

static Matrix4x4 createTranslation (Vector3 translation)
 
static Matrix4x4 createTranslation (float x, float y, float z)
 
static Matrix4x4 createIdentity ()
 
static Matrix4x4 createFromHomogenousMatrix (const Matrix3x3 &matrix, float zTranslation)
 
static Matrix4x4 createFromHomogenousMatrix (const Matrix3x3 &matrix)
 
static Matrix4x4 createXRotation (float angleInDegrees)
 
static Matrix4x4 createYRotation (float angleInDegrees)
 
static Matrix4x4 createZRotation (float angleInDegrees)
 
static Matrix4x4 createScale (Vector3 scale)
 
static Matrix4x4 createOrthogonalProjection (float left, float right, float bottom, float top, float near, float far)
 
static optional< Matrix4x4createLookAtMatrix (Vector3 position, Vector3 lookAtPoint, Vector3 upVector)
 
static Matrix4x4 createSRT (Vector3 scale, Vector3 rotationInRadians, Vector3 translation)
 

Friends

bool operator== (const Matrix4x4 &left, const Matrix4x4 &right)
 
bool operator!= (const Matrix4x4 &left, const Matrix4x4 &right)
 Inequality operator. More...
 

Detailed Description

Matrix with 4x4 elements.

Constructor & Destructor Documentation

kanzi::Matrix4x4::Matrix4x4 ( )
inlineexplicit

Default constructor, initializes the matrix to identity matrix.

kanzi::Matrix4x4::Matrix4x4 ( float  x0,
float  x1,
float  x2,
float  x3,
float  x4,
float  x5,
float  x6,
float  x7,
float  x8,
float  x9,
float  x10,
float  x11,
float  x12,
float  x13,
float  x14,
float  x15 
)
inlineexplicit

Constructs the matrix from elements.

kanzi::Matrix4x4::Matrix4x4 ( const Vector3 x,
const Vector3 y,
const Vector3 z,
const Vector3 translation 
)
inlineexplicit

Constructs the matrix from 4 vectors.

Member Function Documentation

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

Access to individual elements of the matrix.

Parameters
indexIndex of the accessed element. Should be at least 0 and at most 15.
Returns
float& kanzi::Matrix4x4::operator[] ( size_t  index)
inline

Access to individual elements of the matrix.

Parameters
indexIndex of the accessed element. Should be at least 0 and at most 15.
Returns
Vector3 kanzi::Matrix4x4::getXAxis ( ) const
inline
Vector3 kanzi::Matrix4x4::getYAxis ( ) const
inline
Vector3 kanzi::Matrix4x4::getZAxis ( ) const
inline
Vector3 kanzi::Matrix4x4::getTranslation ( ) const
inline
Vector3 kanzi::Matrix4x4::getScale ( ) const
void kanzi::Matrix4x4::scale ( const Vector3 scale)
inline
void kanzi::Matrix4x4::setXAxis ( Vector3  v)
inline
void kanzi::Matrix4x4::setYAxis ( Vector3  v)
inline
void kanzi::Matrix4x4::setZAxis ( Vector3  v)
inline
void kanzi::Matrix4x4::setTranslation ( Vector3  translation)
inline
float kanzi::Matrix4x4::getTranslationX ( ) const
inline

Get translation on X axis.

Returns
Translation X component.
void kanzi::Matrix4x4::setTranslationX ( float  translationX)
inline

Set translation on X axis.

Parameters
translationXTranslation X component.
float kanzi::Matrix4x4::getTranslationY ( ) const
inline

Get translation on Y axis.

Returns
Translation Y component.
void kanzi::Matrix4x4::setTranslationY ( float  translationY)
inline

Set translation on Y axis.

Parameters
translationYTranslation Y component.
float kanzi::Matrix4x4::getTranslationZ ( ) const
inline

Get translation on Z axis.

Returns
Translation Z component.
void kanzi::Matrix4x4::setTranslationZ ( float  translationZ)
inline

Set translation on Z axis.

Parameters
translationZTranslation Y component.
Matrix4x4& kanzi::Matrix4x4::operator+= ( const Matrix4x4 v)
inline

Modifies this matrix by adding another matrix.

Parameters
vAnother matrix.
Returns
This matrix.
Matrix4x4& kanzi::Matrix4x4::operator-= ( const Matrix4x4 v)
inline

Modifies this matrix by subtracting another matrix from this matrix.

Parameters
vAnother matrix.
Returns
This matrix.
Vector3 kanzi::Matrix4x4::operator* ( const Vector3 vector) const
inline

Multiply a 3-component vector with this matrix.

Parameters
vectorA Vector3.
Returns
Result of the multiplication.
Vector4 kanzi::Matrix4x4::operator* ( const Vector4 vector) const
inline

Multiply a 4-component vector with this matrix.

Parameters
vectorA Vector4.
Returns
Result of the multiplication.
Matrix4x4& kanzi::Matrix4x4::operator*= ( const Matrix4x4 m)

Modifies this matrix by multiplying it with another matrix.

Parameters
mAnother matrix.
Returns
This matrix.
static Matrix4x4 kanzi::Matrix4x4::createTranslation ( Vector3  translation)
inlinestatic
static Matrix4x4 kanzi::Matrix4x4::createTranslation ( float  x,
float  y,
float  z 
)
inlinestatic
static Matrix4x4 kanzi::Matrix4x4::createIdentity ( )
inlinestatic
static Matrix4x4 kanzi::Matrix4x4::createFromHomogenousMatrix ( const Matrix3x3 matrix,
float  zTranslation 
)
inlinestatic
static Matrix4x4 kanzi::Matrix4x4::createFromHomogenousMatrix ( const Matrix3x3 matrix)
inlinestatic
static Matrix4x4 kanzi::Matrix4x4::createXRotation ( float  angleInDegrees)
static
static Matrix4x4 kanzi::Matrix4x4::createYRotation ( float  angleInDegrees)
static
static Matrix4x4 kanzi::Matrix4x4::createZRotation ( float  angleInDegrees)
static
static Matrix4x4 kanzi::Matrix4x4::createScale ( Vector3  scale)
static
static Matrix4x4 kanzi::Matrix4x4::createOrthogonalProjection ( float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far 
)
static
static optional<Matrix4x4> kanzi::Matrix4x4::createLookAtMatrix ( Vector3  position,
Vector3  lookAtPoint,
Vector3  upVector 
)
static
static Matrix4x4 kanzi::Matrix4x4::createSRT ( Vector3  scale,
Vector3  rotationInRadians,
Vector3  translation 
)
static
Matrix4x4 kanzi::Matrix4x4::transposed ( ) const
inline

Friends And Related Function Documentation

bool operator== ( const Matrix4x4 left,
const Matrix4x4 right 
)
friend
bool operator!= ( const Matrix4x4 left,
const Matrix4x4 right 
)
friend

Inequality operator.

Parameters
leftLeft-hand-side operand.
rightRight-hand-side operand.
Returns
True if matrices are not equal, false if they are.

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