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)
Methods¶
Methods in detail¶
Mat44_cd ( in Complex_d _00, in Complex_d _01, in Complex_d _02, in Complex_d _03, in Complex_d _10, in Complex_d _11, in Complex_d _12, in Complex_d _13, in Complex_d _20, in Complex_d _21, in Complex_d _22, in Complex_d _23, in Complex_d _30, in Complex_d _31, in Complex_d _32, in Complex_d _33 )
Constructor from scalars
Mat44_cd ( in Mat44_cd other )
copy constructor
Mat44_cd ( in Vec4_cd row0, in Vec4_cd row1, in Vec4_cd row2, in Vec4_cd row3 )
Constructor from vectors
Mat44_cd ()
Mat44_cd Mat44_cd.add? ( in Mat44_cd other )
Overload method for the add operator
Returns the adjoint matrix of this matrix
Boolean Mat44_cd.almostEqual? ( in Mat44_cd other )
Returns true if this matrix is almost the same as another one (using a default precision)
Boolean Mat44_cd.almostEqual? ( in Mat44_cd other, in Float32 precision )
Returns true if this matrix is almost the same as another one (given a precision)
clone method
Complex_d Mat44_cd.determinant? ()
Returns the determinant of this matrix
Mat44_cd Mat44_cd.divideComplex_d? ( in Complex_d other )
Returns the division of this matrix and a scalar
Boolean Mat44_cd.equal? ( in Mat44_cd other )
Returns true if this matrix is the same as another one
Hash for this value
Returns the inverse matrix of this matrix
Mat44_cd Mat44_cd.inverse_safe? ()
Returns the inverse matrix of this matrix, always checking the determinant value.
Boolean Mat44_cd.isNull? ()
returns true if all components in this matrix are 0.0
Mat44_cd Mat44_cd.multiply? ( in Mat44_cd other )
Overload method for the multiply operator
Mat44_cd Mat44_cd.multiplyComplex_d? ( in Complex_d other )
Returns the product of this matrix and a scalar
Vec3_cd Mat44_cd.multiplyVector3? ( in Vec3_cd other )
Returns the product of this matrix and a Vec3_cd
Vec4_cd Mat44_cd.multiplyVector4? ( in Vec4_cd other )
Returns the product of this matrix and a Vec4_cd
Mat44_cd.set! ( in Complex_d _00, in Complex_d _01, in Complex_d _02, in Complex_d _03, in Complex_d _10, in Complex_d _11, in Complex_d _12, in Complex_d _13, in Complex_d _20, in Complex_d _21, in Complex_d _22, in Complex_d _23, in Complex_d _30, in Complex_d _31, in Complex_d _32, in Complex_d _33 )
Sets each component with a single scalar value.
Mat44_cd.set! ( in Vec3_cd translation, in Mat33_cd rotation, in Vec3_cd scaling )
Mat44_cd.setColumns! ( in Vec4_cd col0, in Vec4_cd col1, in Vec4_cd col2, in Vec4_cd col3 )
Setter from vectors, column-wise
Mat44_cd.setDiagonal! ( in Complex_d v )
setting the diagonal components of this matrix to a scalar
Mat44_cd.setDiagonal! ( in Vec3_cd v )
setting the diagonal components of this matrix to the components of a Vec3_cd
Mat44_cd.setDiagonal! ( in Vec4_cd v )
matrix to the components of a Vec4_cd
Mat44_cd.setFromMat33_cd! ( in Mat33_cd m )
set the upper left 3 x 3 components from a Mat33_cd. the remaining components are set to the identify matrix’s content.
Mat44_cd.setIdentity! ()
setting this matrix to the identity matrix
Mat44_cd.setNull! ()
setting all components of the matrix to 0.0
Mat44_cd.setRows! ( in Vec4_cd row0, in Vec4_cd row1, in Vec4_cd row2, in Vec4_cd row3 )
Setter from vectors, row-wise
Mat44_cd.setScaling! ( in Vec3_cd v )
Sets the scaling of the matrix by scaling the rows of the matrix.
注釈
This will preserve the existing matrix content
Mat44_cd.setTranslation! ( in Vec3_cd tr )
Sets the translation components of this matrix to a given Vec3_cd
Mat44_cd.setUpperLeft! ( in Mat33_cd m )
replaces the upper left 3 x 3 components from a Mat33_cd.
Mat44_cd Mat44_cd.subtract? ( in Mat44_cd other )
Overload method for the subtract operator
Vec3_cd Mat44_cd.translation? ()
Returns the translation components of this matrix as a Vec3_cd
Mat44_cd Mat44_cd.transpose? ()
Returns the transposed matrix of this matrix
Mat33_cd Mat44_cd.upperLeft? ()
Returns the upper left 3 x 3 components of this matrix as a Mat33_cd
Mat44_cd.zeroTranslation! ()
Sets the translation components of this matrix to 0.0