PxMat33T
Defined in include/foundation/PxMat33.h
-
template<class Type>
class PxMat33T 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)!
Public Functions
-
inline PxMat33T()
Default constructor.
-
inline PxMat33T(PxIDENTITY)
identity constructor
-
inline PxMat33T(PxZERO)
zero constructor
-
inline PxMat33T(const PxVec3T<Type> &col0, const PxVec3T<Type> &col1, const PxVec3T<Type> &col2)
Construct from three base vectors.
-
inline explicit PxMat33T(Type r)
constructor from a scalar, which generates a multiple of the identity matrix
-
inline const PxVec3T<Type> operator*(const PxVec3T<Type> &vec) const
Matrix vector multiplication (returns ‘this->transform(vec)’)
-
inline const PxVec3T<Type> transform(const PxVec3T<Type> &other) const
Transform vector by matrix, equal to v’ = M*v.