Momentum Scripting v1
Loading...
Searching...
No Matches
MOMENTUM_NAMESPACE::Matrix4x4 Class Reference

#include <Matrix4x4.h>

Public Member Functions

 Matrix4x4 ()
 
 Matrix4x4 (const EulerAngles &rotation, const Vec3 &translation=Vec3())
 
 Matrix4x4 (const Matrix4x4 &mat)
 
 Matrix4x4 (const Quat &rotation, const Vec3 &translation=Vec3())
 
 Matrix4x4 (double a00, double a01, double a02, double a03, double a10, double a11, double a12, double a13, double a20, double a21, double a22, double a23, double a30, double a31, double a32, double a33)
 
 Matrix4x4 (double const *const ptr)
 
 ~Matrix4x4 ()
 
Matrix4x4 addTranslate (const Vec3 &t)
 
Matrix4x4 addTranslate (double tx, double ty, double tz)
 
EulerAngles getAsEulerAngles () const
 
Quat getAsQuat () const
 
Vec4 getCol (size_t col) const
 
Quat getRotate () const
 
Vec4 getRow (size_t row) const
 
Vec3 getTranslate () const
 
Matrix4x4 inverse () const
 
bool isFinite () const
 
bool isIdentity () const
 
bool isNaN () const
 
bool isRigidTransformation () const
 
void mult (const Matrix4x4 &, const Matrix4x4 &)
 
bool operator!= (const Matrix4x4 &m) const
 
double & operator() (size_t row, size_t col)
 
double operator() (size_t row, size_t col) const
 
Matrix4x4 operator* (const Matrix4x4 &m) const
 
Vec3 operator* (const Vec3 &v) const
 
Vec4 operator* (const Vec4 &v) const
 
void operator*= (const Matrix4x4 &other)
 
Matrix4x4 operator= (const Matrix4x4 &rhs)
 
bool operator== (const Matrix4x4 &m) const
 
void postMult (const Matrix4x4 &)
 
Vec3 postMult (const Vec3 &v) const
 
Vec4 postMult (const Vec4 &v) const
 
Matrix4x4 postMultTranslate (const Vec3 &v)
 
void preMult (const Matrix4x4 &)
 
Vec3 preMult (const Vec3 &v) const
 
Vec4 preMult (const Vec4 &v) const
 
Matrix4x4 preMultTranslate (const Vec3 &v)
 
double * ptr ()
 
const double * ptr () const
 
Matrix4x4 set (const EulerAngles &e)
 
Matrix4x4 set (const Quat &q)
 
Matrix4x4 set (double a00, double a01, double a02, double a03, double a10, double a11, double a12, double a13, double a20, double a21, double a22, double a23, double a30, double a31, double a32, double a33)
 
Matrix4x4 set (double const *const ptr)
 
void setCol (size_t col, const Vec4 &vec)
 
Matrix4x4 setIdentity ()
 
Matrix4x4 setRotate (const EulerAngles &euler)
 
Matrix4x4 setRotate (const Quat &q)
 
Matrix4x4 setRotate (const Vec3 &from, const Vec3 &to)
 
Matrix4x4 setRotate (double angle, const Vec3 &axis)
 
Matrix4x4 setRotate (double angle, double x, double y, double z)
 
Matrix4x4 setRotate (double angle1, const Vec3 &axis1, double angle2, const Vec3 &axis2, double angle3, const Vec3 &axis3)
 
void setRow (size_t row, const Vec4 &vec)
 
Matrix4x4 setTranslate (const Vec3 &t)
 
Matrix4x4 setTranslate (double tx, double ty, double tz)
 
Vec3 transform3x3 (const Vec3 &vIn) const
 
Vec3 transform3x3Inv (const Vec3 &vIn) const
 
Matrix4x4 transpose () const
 
bool valid () const
 

Static Public Member Functions

static Matrix4x4 crossMatrix (const Vec3 &vec)
 
static Matrix4x4 rotate (const Vec3 &from, const Vec3 &to)
 
static Matrix4x4 rotate (double angle, const Vec3 &axis)
 
static Matrix4x4 rotate (double angle, double x, double y, double z)
 
static Matrix4x4 rotate (double angle1, const Vec3 &axis1, double angle2, const Vec3 &axis2, double angle3, const Vec3 &axis3)
 
static Matrix4x4 translate (const Vec3 &dv)
 
static Matrix4x4 translate (double x, double y, double z)
 

Detailed Description

Matrix class for affine transformations.

Translations are stored in the last row. The last column will be assumed to be [0 0 0 1]' in all operations, even if it is set to something else.

Constructor & Destructor Documentation

◆ Matrix4x4() [1/6]

MOMENTUM_NAMESPACE::Matrix4x4::Matrix4x4 ( )

Creates a new matrix, initialized to be an identity matrix.

◆ Matrix4x4() [2/6]

MOMENTUM_NAMESPACE::Matrix4x4::Matrix4x4 ( const Matrix4x4 mat)

Copy constructor.

◆ Matrix4x4() [3/6]

MOMENTUM_NAMESPACE::Matrix4x4::Matrix4x4 ( double const *const  ptr)

Create a matrix from a vector of 16 reals.

◆ Matrix4x4() [4/6]

MOMENTUM_NAMESPACE::Matrix4x4::Matrix4x4 ( const Quat rotation,
const Vec3 translation = Vec3() 
)

Create a matrix from a quaternion.

◆ Matrix4x4() [5/6]

MOMENTUM_NAMESPACE::Matrix4x4::Matrix4x4 ( const EulerAngles rotation,
const Vec3 translation = Vec3() 
)

Create a matrix from Euler angles.

◆ Matrix4x4() [6/6]

MOMENTUM_NAMESPACE::Matrix4x4::Matrix4x4 ( double  a00,
double  a01,
double  a02,
double  a03,
double  a10,
double  a11,
double  a12,
double  a13,
double  a20,
double  a21,
double  a22,
double  a23,
double  a30,
double  a31,
double  a32,
double  a33 
)

Create a matrix from 16 double scalars.

◆ ~Matrix4x4()

MOMENTUM_NAMESPACE::Matrix4x4::~Matrix4x4 ( )

Destructor.

Member Function Documentation

◆ addTranslate() [1/2]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::addTranslate ( const Vec3 t)

◆ addTranslate() [2/2]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::addTranslate ( double  tx,
double  ty,
double  tz 
)

◆ crossMatrix()

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::crossMatrix ( const Vec3 vec)
static

Generates a new matrix of a specific type.

◆ getAsEulerAngles()

EulerAngles MOMENTUM_NAMESPACE::Matrix4x4::getAsEulerAngles ( ) const

◆ getAsQuat()

Quat MOMENTUM_NAMESPACE::Matrix4x4::getAsQuat ( ) const
Returns
a quaternion of the rotation part of this matrix (real part > 0 by convention)

◆ getCol()

Vec4 MOMENTUM_NAMESPACE::Matrix4x4::getCol ( size_t  col) const

◆ getRotate()

Quat MOMENTUM_NAMESPACE::Matrix4x4::getRotate ( ) const

◆ getRow()

Vec4 MOMENTUM_NAMESPACE::Matrix4x4::getRow ( size_t  row) const

◆ getTranslate()

Vec3 MOMENTUM_NAMESPACE::Matrix4x4::getTranslate ( ) const

◆ inverse()

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::inverse ( ) const

Matrix inverse.

Returns
the inverse

◆ isFinite()

bool MOMENTUM_NAMESPACE::Matrix4x4::isFinite ( ) const
Returns
true if all the elements are non-NaN and non-inf

◆ isIdentity()

bool MOMENTUM_NAMESPACE::Matrix4x4::isIdentity ( ) const
Returns
true if the matrix is identity.

◆ isNaN()

bool MOMENTUM_NAMESPACE::Matrix4x4::isNaN ( ) const
Returns
true if the matrix is a valid one.

◆ isRigidTransformation()

bool MOMENTUM_NAMESPACE::Matrix4x4::isRigidTransformation ( ) const
Returns
true if the matrix is rigid transformation.

◆ mult()

void MOMENTUM_NAMESPACE::Matrix4x4::mult ( const Matrix4x4 lhs,
const Matrix4x4 rhs 
)

◆ operator!=()

bool MOMENTUM_NAMESPACE::Matrix4x4::operator!= ( const Matrix4x4 m) const

◆ operator()() [1/2]

double & MOMENTUM_NAMESPACE::Matrix4x4::operator() ( size_t  row,
size_t  col 
)

◆ operator()() [2/2]

double MOMENTUM_NAMESPACE::Matrix4x4::operator() ( size_t  row,
size_t  col 
) const

◆ operator*() [1/3]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::operator* ( const Matrix4x4 m) const

◆ operator*() [2/3]

Vec3 MOMENTUM_NAMESPACE::Matrix4x4::operator* ( const Vec3 v) const

◆ operator*() [3/3]

Vec4 MOMENTUM_NAMESPACE::Matrix4x4::operator* ( const Vec4 v) const

◆ operator*=()

void MOMENTUM_NAMESPACE::Matrix4x4::operator*= ( const Matrix4x4 other)

◆ operator=()

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::operator= ( const Matrix4x4 rhs)

◆ operator==()

bool MOMENTUM_NAMESPACE::Matrix4x4::operator== ( const Matrix4x4 m) const

◆ postMult() [1/3]

void MOMENTUM_NAMESPACE::Matrix4x4::postMult ( const Matrix4x4 other)

◆ postMult() [2/3]

Vec3 MOMENTUM_NAMESPACE::Matrix4x4::postMult ( const Vec3 v) const

◆ postMult() [3/3]

Vec4 MOMENTUM_NAMESPACE::Matrix4x4::postMult ( const Vec4 v) const

◆ postMultTranslate()

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::postMultTranslate ( const Vec3 v)

◆ preMult() [1/3]

void MOMENTUM_NAMESPACE::Matrix4x4::preMult ( const Matrix4x4 other)

◆ preMult() [2/3]

Vec3 MOMENTUM_NAMESPACE::Matrix4x4::preMult ( const Vec3 v) const

◆ preMult() [3/3]

Vec4 MOMENTUM_NAMESPACE::Matrix4x4::preMult ( const Vec4 v) const

◆ preMultTranslate()

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::preMultTranslate ( const Vec3 v)

◆ ptr() [1/2]

double * MOMENTUM_NAMESPACE::Matrix4x4::ptr ( )

◆ ptr() [2/2]

const double * MOMENTUM_NAMESPACE::Matrix4x4::ptr ( ) const

◆ rotate() [1/4]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::rotate ( const Vec3 from,
const Vec3 to 
)
static

◆ rotate() [2/4]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::rotate ( double  angle,
const Vec3 axis 
)
static

◆ rotate() [3/4]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::rotate ( double  angle,
double  x,
double  y,
double  z 
)
static

◆ rotate() [4/4]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::rotate ( double  angle1,
const Vec3 axis1,
double  angle2,
const Vec3 axis2,
double  angle3,
const Vec3 axis3 
)
static

◆ set() [1/4]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::set ( const EulerAngles e)

◆ set() [2/4]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::set ( const Quat q)

◆ set() [3/4]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::set ( double  a00,
double  a01,
double  a02,
double  a03,
double  a10,
double  a11,
double  a12,
double  a13,
double  a20,
double  a21,
double  a22,
double  a23,
double  a30,
double  a31,
double  a32,
double  a33 
)

◆ set() [4/4]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::set ( double const *const  ptr)
  • set(arg) sets the entire matrix, overwriting all previous values.
  • setRotate(arg) sets the rotational part of the matrix, leaving the translation intact.
  • setTranslate(arg) sets the translational part, without affecting the rotation.
  • setIdentity() creates the identity matrix

They all return a reference to the updated matrix, enabling chained commands. E.g: matrix.setRotate(q).setTranslate(pos)

◆ setCol()

void MOMENTUM_NAMESPACE::Matrix4x4::setCol ( size_t  col,
const Vec4 vec 
)

◆ setIdentity()

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::setIdentity ( )

◆ setRotate() [1/6]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::setRotate ( const EulerAngles euler)

◆ setRotate() [2/6]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::setRotate ( const Quat q)

◆ setRotate() [3/6]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::setRotate ( const Vec3 from,
const Vec3 to 
)

◆ setRotate() [4/6]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::setRotate ( double  angle,
const Vec3 axis 
)

◆ setRotate() [5/6]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::setRotate ( double  angle,
double  x,
double  y,
double  z 
)

◆ setRotate() [6/6]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::setRotate ( double  angle1,
const Vec3 axis1,
double  angle2,
const Vec3 axis2,
double  angle3,
const Vec3 axis3 
)

◆ setRow()

void MOMENTUM_NAMESPACE::Matrix4x4::setRow ( size_t  row,
const Vec4 vec 
)

Set the row of the matrix,.

Parameters
rowmust be between [0..3]
vec- value of the row

◆ setTranslate() [1/2]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::setTranslate ( const Vec3 t)

◆ setTranslate() [2/2]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::setTranslate ( double  tx,
double  ty,
double  tz 
)

◆ transform3x3()

Vec3 MOMENTUM_NAMESPACE::Matrix4x4::transform3x3 ( const Vec3 vIn) const

◆ transform3x3Inv()

Vec3 MOMENTUM_NAMESPACE::Matrix4x4::transform3x3Inv ( const Vec3 vIn) const

◆ translate() [1/2]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::translate ( const Vec3 dv)
static

◆ translate() [2/2]

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::translate ( double  x,
double  y,
double  z 
)
static

◆ transpose()

Matrix4x4 MOMENTUM_NAMESPACE::Matrix4x4::transpose ( ) const
Returns
the transpose

◆ valid()

bool MOMENTUM_NAMESPACE::Matrix4x4::valid ( ) const
Returns
true if the matrix does not contain any NaN values