Mat44_cd.kl¶
Types¶
Mat44_cd (struct)¶
The Mat44_cd represents a 4 by 4 matrix. It uses Vec4_cd types for each of the 4 rows.
/*
** Example: Mat44_cd
*/
// create a matrix 4x4
Vec4_cd v0(1.0, 0.0, 0.0, 0.0);
Vec4_cd v1(0.0, 1.0, 0.0, 0.0);
Vec4_cd v2(0.0, 0.0, 1.0, 0.0);
Vec4_cd v3(0.0, 0.0, 0.0, 1.0);
Mat44_cd mat(v0, v1, v2, v3);
Fabric Engine Matrices are column-major rather than row-major¶
Most DCCs follow a row-major convention for expressing their matrices which implies that multiplication of matrices occurs in the opposite order to those in Fabric Engine.
In Maya and Softimage, to transform a point (P) by a matrix (WM), you would post-multiply the vector by the matrix by placing it on the left side of the matrix.
(P’ = P x WM)
In Fabric Engine, to transform a point (P) by a matrix (WM), you would post-multiply it by placing it on the right hand side of the matrix.
(P’ = WM x P)
When multiplying matrices together, the order of the matrices is also swapped when compared to Maya/Softimage.
To Transform a Matrix (M) into the space of a another matrix (WM), you would place the L on the right hand side of WM
(M’ = WM x M)
In Maya, Softimage and 3dsmax, the order of the matrices in the multiplication would be swapped.
(M’ = M x WM)