|
RavEngine
|
3x3 matrix class More...
#include <PxMat33.h>
Public Member Functions | |
| PX_CUDA_CALLABLE PX_FORCE_INLINE | PxMat33T () |
| Default constructor. | |
| PX_CUDA_CALLABLE PX_INLINE | PxMat33T (PxIDENTITY) |
| identity constructor | |
| PX_CUDA_CALLABLE PX_INLINE | PxMat33T (PxZERO) |
| zero constructor | |
| PX_CUDA_CALLABLE | PxMat33T (const PxVec3T< Type > &col0, const PxVec3T< Type > &col1, const PxVec3T< Type > &col2) |
| Construct from three base vectors. | |
| PX_CUDA_CALLABLE PX_INLINE | PxMat33T (Type r) |
| constructor from a scalar, which generates a multiple of the identity matrix | |
| PX_CUDA_CALLABLE PX_INLINE | PxMat33T (Type values[]) |
| Construct from Type[9]. | |
| PX_CUDA_CALLABLE PX_FORCE_INLINE | PxMat33T (const PxQuatT< Type > &q) |
| Construct from a quaternion. | |
| PX_CUDA_CALLABLE PX_INLINE | PxMat33T (const PxMat33T &other) |
| Copy constructor. | |
| PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33T & | operator= (const PxMat33T &other) |
| Assignment operator. | |
| PX_CUDA_CALLABLE PX_INLINE bool | operator== (const PxMat33T &m) const |
| returns true if the two matrices are exactly equal | |
| PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33T | getTranspose () const |
| Get transposed matrix. | |
| PX_CUDA_CALLABLE PX_INLINE const PxMat33T | getInverse () const |
| Get the real inverse. | |
| PX_CUDA_CALLABLE PX_INLINE Type | getDeterminant () const |
| Get determinant. | |
| PX_CUDA_CALLABLE PX_INLINE const PxMat33T | operator- () const |
| Unary minus. | |
| PX_CUDA_CALLABLE PX_INLINE const PxMat33T | operator+ (const PxMat33T &other) const |
| Add. | |
| PX_CUDA_CALLABLE PX_INLINE const PxMat33T | operator- (const PxMat33T &other) const |
| Subtract. | |
| PX_CUDA_CALLABLE PX_INLINE const PxMat33T | operator* (Type scalar) const |
| Scalar multiplication. | |
| PX_CUDA_CALLABLE PX_INLINE const PxVec3T< Type > | operator* (const PxVec3T< Type > &vec) const |
| Matrix vector multiplication (returns 'this->transform(vec)') | |
| PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33T | operator* (const PxMat33T &other) const |
| Matrix multiplication. | |
| PX_CUDA_CALLABLE PX_INLINE PxMat33T & | operator+= (const PxMat33T &other) |
| Equals-add. | |
| PX_CUDA_CALLABLE PX_INLINE PxMat33T & | operator-= (const PxMat33T &other) |
| Equals-sub. | |
| PX_CUDA_CALLABLE PX_INLINE PxMat33T & | operator*= (Type scalar) |
| Equals scalar multiplication. | |
| PX_CUDA_CALLABLE PX_INLINE PxMat33T & | operator*= (const PxMat33T &other) |
| Equals matrix multiplication. | |
| PX_CUDA_CALLABLE PX_FORCE_INLINE Type | operator() (PxU32 row, PxU32 col) const |
| Element access, mathematical way! | |
| PX_CUDA_CALLABLE PX_FORCE_INLINE Type & | operator() (PxU32 row, PxU32 col) |
| Element access, mathematical way! | |
| PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3T< Type > | transform (const PxVec3T< Type > &other) const |
| Transform vector by matrix, equal to v' = M*v. | |
| PX_CUDA_CALLABLE PX_INLINE const PxVec3T< Type > | transformTranspose (const PxVec3T< Type > &other) const |
| Transform vector by matrix transpose, v' = M^t*v. | |
| PX_CUDA_CALLABLE PX_FORCE_INLINE const Type * | front () const |
| PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T< Type > & | operator[] (PxU32 num) |
| PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3T< Type > & | operator[] (PxU32 num) const |
Static Public Member Functions | |
| PX_CUDA_CALLABLE static PX_INLINE const PxMat33T | createDiagonal (const PxVec3T< Type > &d) |
| Construct from diagonal, off-diagonals are zero. | |
| PX_CUDA_CALLABLE static PX_INLINE const PxMat33T | outer (const PxVec3T< Type > &a, const PxVec3T< Type > &b) |
| Computes the outer product of two vectors. | |
Public Attributes | |
| PxVec3T< Type > | column0 |
| PxVec3T< Type > | column1 |
| PxVec3T< Type > | column2 |
Friends | |
| template<class Type2 > | |
| PX_CUDA_CALLABLE PX_INLINE friend PxMat33T< Type2 > | operator* (Type2, const PxMat33T< Type2 > &) |
3x3 matrix class
Some clarifications, as there have been much confusion about matrix formats etc in the past.
Short:
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)!