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

#include <AffineMatrix4x4.h>

Public Member Functions

 AffineMatrix4x4 ()
 
 AffineMatrix4x4 (const AffineMatrix4x4 &mat)
 
 AffineMatrix4x4 (const agx::AffineMatrix4x4 &mat)
 
 AffineMatrix4x4 (const EulerAngles &rotation, const Vec3 &translation=Vec3())
 
 AffineMatrix4x4 (const Quat &rotation, const Vec3 &translation=Vec3())
 
 AffineMatrix4x4 (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)
 
 AffineMatrix4x4 (double const *const ptr)
 
 ~AffineMatrix4x4 ()
 
Matrix4x4 addTranslate (const Vec3 &t)
 
Matrix4x4 addTranslate (double tx, double ty, double tz)
 
double at (int i, int j) const
 
EulerAngles getAsEulerAngles () const
 
Quat getAsQuat () const
 
Vec4 getCol (size_t col) const
 
Vec3 getInvTranslate () const
 
Quat getRotate () const
 
Vec4 getRow (size_t row) const
 
Vec3 getTranslate () const
 
AffineMatrix4x4 inverse () const
 
bool isFinite () const
 
bool isIdentity () const
 
bool isNaN () const
 
bool isRigidTransformation () const
 
void mult (const AffineMatrix4x4 &, const AffineMatrix4x4 &)
 
void mult (const Matrix4x4 &, const Matrix4x4 &)
 
bool operator!= (const AffineMatrix4x4 &m) const
 
bool operator!= (const Matrix4x4 &m) const
 
double & operator() (size_t row, size_t col)
 
double operator() (size_t row, size_t col) const
 
AffineMatrix4x4 operator* (const AffineMatrix4x4 &m) const
 
Matrix4x4 operator* (const Matrix4x4 &m) const
 
Vec3 operator* (const Vec3 &v) const
 
Vec4 operator* (const Vec4 &v) const
 
void operator*= (const AffineMatrix4x4 &other)
 
void operator*= (const Matrix4x4 &other)
 
AffineMatrix4x4operator= (const AffineMatrix4x4 &rhs)
 
AffineMatrix4x4operator= (const Matrix4x4 &rhs)
 
bool operator== (const AffineMatrix4x4 &m) const
 
bool operator== (const Matrix4x4 &m) const
 
void postMult (const AffineMatrix4x4 &)
 
void postMult (const Matrix4x4 &)
 
Vec3 postMult (const Vec3 &v) const
 
Vec4 postMult (const Vec4 &v) const
 
AffineMatrix4x4postMultTranslate (const Vec3 &v)
 
void preMult (const AffineMatrix4x4 &)
 
void preMult (const Matrix4x4 &)
 
Vec3 preMult (const Vec3 &v) const
 
Vec4 preMult (const Vec4 &v) const
 
AffineMatrix4x4preMultTranslate (const Vec3 &v)
 
double * ptr ()
 
const double * ptr () const
 
void set (const EulerAngles &e)
 
void set (const Quat &q)
 
void 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)
 
void set (double const *const ptr)
 
void set (double val, int i, int j)
 
void setCol (size_t col, const Vec4 &vec)
 
void setIdentity ()
 
void setRotate (const EulerAngles &euler)
 
void setRotate (const Quat &q)
 
void setRotate (const Vec3 &from, const Vec3 &to)
 
void setRotate (double angle, const Vec3 &axis)
 
void setRotate (double angle, double x, double y, double z)
 
void setRotate (double angle1, const Vec3 &axis1, double angle2, const Vec3 &axis2, double angle3, const Vec3 &axis3)
 
void setRow (size_t row, const Vec4 &vec)
 
void setTranslate (const Vec3 &t)
 
void setTranslate (double tx, double ty, double tz)
 
Vec3 transform3x3 (const Vec3 &vIn) const
 
Vec3 transform3x3Inv (const Vec3 &vIn) const
 
Vec3 transformPoint (const Vec3 &point) const
 
Vec3 transformVector (const Vec3 &vector) const
 
Matrix4x4 transpose () const
 
bool valid () const
 

Static Public Member Functions

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

Detailed Description

Matrix class for rigid transformations (translation, rotation).

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. The sub matrix containing the first three rows and columns contains the rotational part and is assumed to be orthonormal.

Constructor & Destructor Documentation

◆ AffineMatrix4x4() [1/7]

MOMENTUM_NAMESPACE::AffineMatrix4x4::AffineMatrix4x4 ( )

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

◆ AffineMatrix4x4() [2/7]

MOMENTUM_NAMESPACE::AffineMatrix4x4::AffineMatrix4x4 ( const agx::AffineMatrix4x4 &  mat)

◆ AffineMatrix4x4() [3/7]

MOMENTUM_NAMESPACE::AffineMatrix4x4::AffineMatrix4x4 ( const AffineMatrix4x4 mat)

Copy constructor.

◆ AffineMatrix4x4() [4/7]

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

Create a matrix from a vector of 16 reals.

◆ AffineMatrix4x4() [5/7]

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

Create a matrix from a quaternion.

◆ AffineMatrix4x4() [6/7]

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

Create a matrix from Euler angles.

◆ AffineMatrix4x4() [7/7]

MOMENTUM_NAMESPACE::AffineMatrix4x4::AffineMatrix4x4 ( 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.

◆ ~AffineMatrix4x4()

MOMENTUM_NAMESPACE::AffineMatrix4x4::~AffineMatrix4x4 ( )

Destructor.

Member Function Documentation

◆ addTranslate() [1/2]

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

◆ addTranslate() [2/2]

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

◆ at()

double MOMENTUM_NAMESPACE::AffineMatrix4x4::at ( int  i,
int  j 
) const
Returns
the element at i,j.

◆ crossMatrix()

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

◆ getAsEulerAngles()

EulerAngles MOMENTUM_NAMESPACE::Matrix4x4::getAsEulerAngles ( ) const
inherited

◆ getAsQuat()

Quat MOMENTUM_NAMESPACE::Matrix4x4::getAsQuat ( ) const
inherited
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
inherited

◆ getInvTranslate()

Vec3 MOMENTUM_NAMESPACE::AffineMatrix4x4::getInvTranslate ( ) const
Returns
The inverse translation

◆ getRotate()

Quat MOMENTUM_NAMESPACE::Matrix4x4::getRotate ( ) const
inherited

◆ getRow()

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

◆ getTranslate()

Vec3 MOMENTUM_NAMESPACE::Matrix4x4::getTranslate ( ) const
inherited

◆ inverse()

AffineMatrix4x4 MOMENTUM_NAMESPACE::AffineMatrix4x4::inverse ( ) const

Quick inverse, transpose rotation part, and change sign of translation part.

Returns
the inverse

◆ isFinite()

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

◆ isIdentity()

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

◆ isNaN()

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

◆ isRigidTransformation()

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

◆ mult() [1/2]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::mult ( const AffineMatrix4x4 ,
const AffineMatrix4x4  
)

◆ mult() [2/2]

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

◆ operator!=() [1/2]

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

◆ operator!=() [2/2]

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

◆ operator()() [1/2]

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

◆ operator()() [2/2]

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

◆ operator*() [1/4]

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

◆ operator*() [2/4]

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

◆ operator*() [3/4]

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

◆ operator*() [4/4]

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

◆ operator*=() [1/2]

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

◆ operator*=() [2/2]

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

◆ operator=() [1/2]

AffineMatrix4x4 & MOMENTUM_NAMESPACE::AffineMatrix4x4::operator= ( const AffineMatrix4x4 rhs)

◆ operator=() [2/2]

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

◆ operator==() [1/2]

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

◆ operator==() [2/2]

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

◆ postMult() [1/4]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::postMult ( const AffineMatrix4x4 )

◆ postMult() [2/4]

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

◆ postMult() [3/4]

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

◆ postMult() [4/4]

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

◆ postMultTranslate()

AffineMatrix4x4 & MOMENTUM_NAMESPACE::AffineMatrix4x4::postMultTranslate ( const Vec3 v)

◆ preMult() [1/4]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::preMult ( const AffineMatrix4x4 )

◆ preMult() [2/4]

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

◆ preMult() [3/4]

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

◆ preMult() [4/4]

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

◆ preMultTranslate()

AffineMatrix4x4 & MOMENTUM_NAMESPACE::AffineMatrix4x4::preMultTranslate ( const Vec3 v)

◆ ptr() [1/2]

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

◆ ptr() [2/2]

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

◆ rotate() [1/5]

static AffineMatrix4x4 MOMENTUM_NAMESPACE::AffineMatrix4x4::rotate ( const EulerAngles euler)
static

Return a matrix with the rotational part specified by the euler angles argument.

Returns
A new matrix with specified rotation

◆ rotate() [2/5]

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

Return a matrix which rotate a vector from from to to.

Parameters
from- start of rotation
to- end of rotation
Returns
A new matrix with specified rotation

◆ rotate() [3/5]

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

Return a matrix which rotate angle radians around vector axis.

Parameters
angle- angle in radians
axis- vector
Returns
A new matrix with specified rotation

◆ rotate() [4/5]

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

Return a matrix which rotate angle radians around vector [x,y,z].

Parameters
angle- angle in radians
x- x element of vector
y- y element of vector
z- z element of vector
Returns
A new matrix with specified rotation

◆ rotate() [5/5]

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

Return a matrix which rotate angle1 radians around vector axis1 and angle2 radians around vector axis2 angle3 radians around vector axis3.

Parameters
angle1- angle in radians
axis1- vector
angle2- angle in radians
axis2- vector
angle3- angle in radians
axis3- vector
Returns
A new matrix with specified rotation

◆ set() [1/5]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::set ( const EulerAngles e)

Set the rotational part of the matrix using the specified euler angles and the translational part to 0,0,0.

Parameters
e- Specified euler angles rotation

◆ set() [2/5]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::set ( const Quat q)

Set the rotational part of the matrix using the specified quaternion and the translational part to 0,0,0.

Parameters
q- Specified quaternion

◆ set() [3/5]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::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 the entire matrix using values from the 16 elements using the following order:

m_data[0][0] = a00; m_data[0][1] = a01; m_data[0][2] = a02; m_data[0][3] = a03;

m_data[1][0] = a04;

etc.

Parameters
pointerto a vector with 16 elements

◆ set() [4/5]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::set ( double const *const  ptr)

Set the entire matrix using values from the array with 16 elements using the following order:

m_data[0][0] = ptr[0]; m_data[0][1] = ptr[1]; m_data[0][2] = ptr[2]; m_data[0][3] = ptr[3];

m_data[1][0] = ptr[4];

etc.

Parameters
pointerto a vector with 16 elements

◆ set() [5/5]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::set ( double  val,
int  i,
int  j 
)

Set the value of element i,j.

◆ setCol()

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

◆ setIdentity()

void MOMENTUM_NAMESPACE::AffineMatrix4x4::setIdentity ( )

Set the value of the matrix to the identity matrix.

◆ setRotate() [1/6]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::setRotate ( const EulerAngles euler)

Set the rotational part of the matrix using the specified euler angles leaving the translational part untouched.

Parameters
w- Specified euler angles rotation

◆ setRotate() [2/6]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::setRotate ( const Quat q)

Set the rotational part of the matrix using the specified quaternion leaving the translational part untouched.

Parameters
q- Specified quaternion

◆ setRotate() [3/6]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::setRotate ( const Vec3 from,
const Vec3 to 
)

Set the rotational part of the matrix using the specified two vectors.

The resulting rotation will be a rotation matrix which rotates a vector from from to to leaving the translational part untouched.

Parameters
from- start of rotation
to- end of rotation

◆ setRotate() [4/6]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::setRotate ( double  angle,
const Vec3 axis 
)

Set the rotational part of a matrix which rotate angle radians around vector axis.

Parameters
angle- angle in radians
axis- vector

◆ setRotate() [5/6]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::setRotate ( double  angle,
double  x,
double  y,
double  z 
)

Set the rotational part of a matrix which rotate angle radians around vector x y z.

Parameters
angle- angle in radians
x,y,z- vector

◆ setRotate() [6/6]

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

Set the rotational part of a matrix which rotate angle1 radians around vector axis1 and angle2 radians around vector axis2 angle3 radians around vector axis3.

Parameters
angle1- angle in radians
axis1- vector
angle2- angle in radians
axis2- vector
angle3- angle in radians
axis3- vector

◆ setRow()

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

Set the row of the matrix,.

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

◆ setTranslate() [1/2]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::setTranslate ( const Vec3 t)

Set the translational part of the matrix using the vector t.

Parameters
t- translation vector

◆ setTranslate() [2/2]

void MOMENTUM_NAMESPACE::AffineMatrix4x4::setTranslate ( double  tx,
double  ty,
double  tz 
)

Set the translational part of the matrix using the vector x, y, z.

Parameters
x,y,z- translation vector

◆ transform3x3()

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

◆ transform3x3Inv()

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

◆ transformPoint()

Vec3 MOMENTUM_NAMESPACE::AffineMatrix4x4::transformPoint ( const Vec3 point) const

Transforms a (mathematical) point, using both rotation and translation.

◆ transformVector()

Vec3 MOMENTUM_NAMESPACE::AffineMatrix4x4::transformVector ( const Vec3 vector) const

Transforms a (mathematical) vector, using only rotation.

◆ translate() [1/2]

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

Return a matrix which translates according to dv.

Parameters
dv- translation vector
Returns
A new matrix with specified translation

◆ translate() [2/2]

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

Return a matrix which translates according to vector [x,y,z].

Parameters
x- x element of vector
y- y element of vector
z- z element of vector
Returns
A new matrix with specified translation

◆ transpose()

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

◆ valid()

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