PxMat33 Class Reference

3x3 matrix class More...

#include <PxMat33.h>

Collaboration diagram for PxMat33:

Public Member Functions

PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33 ()
 Default constructor. More...
 
PX_CUDA_CALLABLE PX_INLINE PxMat33 (PxIDENTITY r)
 identity constructor More...
 
PX_CUDA_CALLABLE PX_INLINE PxMat33 (PxZERO r)
 zero constructor More...
 
PX_CUDA_CALLABLE PxMat33 (const PxVec3 &col0, const PxVec3 &col1, const PxVec3 &col2)
 Construct from three base vectors. More...
 
PX_CUDA_CALLABLE PX_INLINE PxMat33 (float r)
 constructor from a scalar, which generates a multiple of the identity matrix More...
 
PX_CUDA_CALLABLE PX_INLINE PxMat33 (float values[])
 Construct from float[9]. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33 (const PxQuat &q)
 Construct from a quaternion. More...
 
PX_CUDA_CALLABLE PX_INLINE PxMat33 (const PxMat33 &other)
 Copy constructor. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33operator= (const PxMat33 &other)
 Assignment operator. More...
 
PX_CUDA_CALLABLE PX_INLINE bool operator== (const PxMat33 &m) const
 returns true if the two matrices are exactly equal More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33 getTranspose () const
 Get transposed matrix. More...
 
PX_CUDA_CALLABLE PX_INLINE const PxMat33 getInverse () const
 Get the real inverse. More...
 
PX_CUDA_CALLABLE PX_INLINE float getDeterminant () const
 Get determinant. More...
 
PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator- () const
 Unary minus. More...
 
PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator+ (const PxMat33 &other) const
 Add. More...
 
PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator- (const PxMat33 &other) const
 Subtract. More...
 
PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator* (float scalar) const
 Scalar multiplication. More...
 
PX_CUDA_CALLABLE PX_INLINE const PxVec3 operator* (const PxVec3 &vec) const
 Matrix vector multiplication (returns 'this->transform(vec)') More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33 operator* (const PxMat33 &other) const
 Matrix multiplication. More...
 
PX_CUDA_CALLABLE PX_INLINE PxMat33operator+= (const PxMat33 &other)
 Equals-add. More...
 
PX_CUDA_CALLABLE PX_INLINE PxMat33operator-= (const PxMat33 &other)
 Equals-sub. More...
 
PX_CUDA_CALLABLE PX_INLINE PxMat33operator*= (float scalar)
 Equals scalar multiplication. More...
 
PX_CUDA_CALLABLE PX_INLINE PxMat33operator*= (const PxMat33 &other)
 Equals matrix multiplication. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE float operator() (unsigned int row, unsigned int col) const
 Element access, mathematical way! More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE float & operator() (unsigned int row, unsigned int col)
 Element access, mathematical way! More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 transform (const PxVec3 &other) const
 Transform vector by matrix, equal to v' = M*v. More...
 
PX_CUDA_CALLABLE PX_INLINE const PxVec3 transformTranspose (const PxVec3 &other) const
 Transform vector by matrix transpose, v' = M^t*v. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE const float * front () const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3operator[] (unsigned int num)
 
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3operator[] (unsigned int num) const
 

Static Public Member Functions

PX_CUDA_CALLABLE static PX_INLINE const PxMat33 createDiagonal (const PxVec3 &d)
 Construct from diagonal, off-diagonals are zero. More...
 

Public Attributes

PxVec3 column0
 
PxVec3 column1
 
PxVec3 column2
 

Friends

PxMat33 operator* (float, const PxMat33 &)
 

Detailed Description

3x3 matrix class

Some clarifications, as there have been much confusion about matrix formats etc in the past.

Short:

  • Matrix have base vectors in columns (vectors are column matrices, 3x1 matrices).
  • Matrix is physically stored in column major format
  • Matrices are concaternated from left

Long: Given three base vectors a, b and c the matrix is stored as

|a.x b.x c.x| |a.y b.y c.y| |a.z b.z c.z|

Vectors are treated as columns, so the vector v is

|x| |y| |z|

And matrices are applied _before_ the vector (pre-multiplication) v' = M*v

|x'| |a.x b.x c.x| |x| |a.x*x + b.x*y + c.x*z| |y'| = |a.y b.y c.y| * |y| = |a.y*x + b.y*y + c.y*z| |z'| |a.z b.z c.z| |z| |a.z*x + b.z*y + c.z*z|

Physical storage and indexing: To be compatible with popular 3d rendering APIs (read D3d and OpenGL) the physical indexing is

|0 3 6| |1 4 7| |2 5 8|

index = column*3 + row

which in C++ translates to M[column][row]

The mathematical indexing is M_row,column and this is what is used for _-notation so _12 is 1st row, second column and operator(row, column)!

Constructor & Destructor Documentation

◆ PxMat33() [1/8]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33::PxMat33 ( )
inline

Default constructor.

◆ PxMat33() [2/8]

PX_CUDA_CALLABLE PX_INLINE PxMat33::PxMat33 ( PxIDENTITY  r)
inline

identity constructor

References PX_UNUSED().

◆ PxMat33() [3/8]

PX_CUDA_CALLABLE PX_INLINE PxMat33::PxMat33 ( PxZERO  r)
inline

zero constructor

References PX_UNUSED().

◆ PxMat33() [4/8]

PX_CUDA_CALLABLE PxMat33::PxMat33 ( const PxVec3 col0,
const PxVec3 col1,
const PxVec3 col2 
)
inline

Construct from three base vectors.

◆ PxMat33() [5/8]

PX_CUDA_CALLABLE PX_INLINE PxMat33::PxMat33 ( float  r)
inlineexplicit

constructor from a scalar, which generates a multiple of the identity matrix

◆ PxMat33() [6/8]

PX_CUDA_CALLABLE PX_INLINE PxMat33::PxMat33 ( float  values[])
inlineexplicit

Construct from float[9].

◆ PxMat33() [7/8]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33::PxMat33 ( const PxQuat q)
inlineexplicit

Construct from a quaternion.

References PxQuat::w, PxQuat::x, PxQuat::y, and PxQuat::z.

◆ PxMat33() [8/8]

PX_CUDA_CALLABLE PX_INLINE PxMat33::PxMat33 ( const PxMat33 other)
inline

Copy constructor.

Member Function Documentation

◆ createDiagonal()

PX_CUDA_CALLABLE static PX_INLINE const PxMat33 PxMat33::createDiagonal ( const PxVec3 d)
inlinestatic

Construct from diagonal, off-diagonals are zero.

References PxVec3::x, PxVec3::y, and PxVec3::z.

Referenced by PxMassProperties::PxMassProperties().

◆ front()

PX_CUDA_CALLABLE PX_FORCE_INLINE const float* PxMat33::front ( ) const
inline

◆ getDeterminant()

PX_CUDA_CALLABLE PX_INLINE float PxMat33::getDeterminant ( ) const
inline

Get determinant.

◆ getInverse()

PX_CUDA_CALLABLE PX_INLINE const PxMat33 PxMat33::getInverse ( ) const
inline

Get the real inverse.

References column0, column1, column2, PxIdentity, PxVec3::x, PxVec3::y, and PxVec3::z.

◆ getTranspose()

PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33 PxMat33::getTranspose ( ) const
inline

◆ operator()() [1/2]

PX_CUDA_CALLABLE PX_FORCE_INLINE float PxMat33::operator() ( unsigned int  row,
unsigned int  col 
) const
inline

Element access, mathematical way!

◆ operator()() [2/2]

PX_CUDA_CALLABLE PX_FORCE_INLINE float& PxMat33::operator() ( unsigned int  row,
unsigned int  col 
)
inline

Element access, mathematical way!

◆ operator*() [1/3]

PX_CUDA_CALLABLE PX_INLINE const PxMat33 PxMat33::operator* ( float  scalar) const
inline

Scalar multiplication.

◆ operator*() [2/3]

PX_CUDA_CALLABLE PX_INLINE const PxVec3 PxMat33::operator* ( const PxVec3 vec) const
inline

Matrix vector multiplication (returns 'this->transform(vec)')

◆ operator*() [3/3]

PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33 PxMat33::operator* ( const PxMat33 other) const
inline

Matrix multiplication.

References column0, column1, and column2.

◆ operator*=() [1/2]

PX_CUDA_CALLABLE PX_INLINE PxMat33& PxMat33::operator*= ( float  scalar)
inline

Equals scalar multiplication.

◆ operator*=() [2/2]

PX_CUDA_CALLABLE PX_INLINE PxMat33& PxMat33::operator*= ( const PxMat33 other)
inline

Equals matrix multiplication.

◆ operator+()

PX_CUDA_CALLABLE PX_INLINE const PxMat33 PxMat33::operator+ ( const PxMat33 other) const
inline

Add.

References column0, column1, and column2.

◆ operator+=()

PX_CUDA_CALLABLE PX_INLINE PxMat33& PxMat33::operator+= ( const PxMat33 other)
inline

Equals-add.

References column0, column1, and column2.

◆ operator-() [1/2]

PX_CUDA_CALLABLE PX_INLINE const PxMat33 PxMat33::operator- ( ) const
inline

Unary minus.

◆ operator-() [2/2]

PX_CUDA_CALLABLE PX_INLINE const PxMat33 PxMat33::operator- ( const PxMat33 other) const
inline

Subtract.

References column0, column1, and column2.

◆ operator-=()

PX_CUDA_CALLABLE PX_INLINE PxMat33& PxMat33::operator-= ( const PxMat33 other)
inline

Equals-sub.

References column0, column1, and column2.

◆ operator=()

PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33& PxMat33::operator= ( const PxMat33 other)
inline

Assignment operator.

References column0, column1, and column2.

◆ operator==()

PX_CUDA_CALLABLE PX_INLINE bool PxMat33::operator== ( const PxMat33 m) const
inline

returns true if the two matrices are exactly equal

References column0, column1, and column2.

◆ operator[]() [1/2]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& PxMat33::operator[] ( unsigned int  num)
inline

◆ operator[]() [2/2]

PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& PxMat33::operator[] ( unsigned int  num) const
inline

◆ transform()

PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 PxMat33::transform ( const PxVec3 other) const
inline

Transform vector by matrix, equal to v' = M*v.

References PxVec3::x, PxVec3::y, and PxVec3::z.

◆ transformTranspose()

PX_CUDA_CALLABLE PX_INLINE const PxVec3 PxMat33::transformTranspose ( const PxVec3 other) const
inline

Transform vector by matrix transpose, v' = M^t*v.

Friends And Related Function Documentation

◆ operator*

PxMat33 operator* ( float  ,
const PxMat33  
)
friend

Member Data Documentation

◆ column0

◆ column1

◆ column2


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