Mat44 (struct)¶
The Mat44 represents a 4 by 4 matrix. It uses Vec4 types for each of the 4 rows.
/*
** Example: Mat44
*/
// create a matrix 4x4
Vec4 v0(1.0, 0.0, 0.0, 0.0);
Vec4 v1(0.0, 1.0, 0.0, 0.0);
Vec4 v2(0.0, 0.0, 1.0, 0.0);
Vec4 v3(0.0, 0.0, 0.0, 1.0);
Mat44 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¶
Mat44 ( in Mat44 other ) | |
Mat44 ( in Scalar _00, in Scalar _01, in Scalar _02, in Scalar _03, in Scalar _10, in Scalar _11, in Scalar _12, in Scalar _13, in Scalar _20, in Scalar _21, in Scalar _22, in Scalar _23, in Scalar _30, in Scalar _31, in Scalar _32, in Scalar _33 ) | |
Mat44 ( in Vec4 row0, in Vec4 row1, in Vec4 row2, in Vec4 row3 ) | |
Mat44 () | |
Mat44 | add ? ( in Mat44 other ) |
Mat44 | adjoint ? () |
Boolean | almostEqual ? ( in Mat44 other ) |
Boolean | almostEqual ? ( in Mat44 other, in Scalar precision ) |
Mat44 | clone ? () |
decompose ? ( out Vec3 scaling, out Mat33 rotation, out Vec3 translation ) | |
Scalar | determinant ? () |
Mat44 | divideScalar ? ( in Scalar other ) |
Boolean | equal ? ( in Mat44 other ) |
get ? ( io Float32 v<> ) | |
get ? ( io Float32 v<>, in UInt32 o ) | |
get ? ( io Float32 v[] ) | |
get ? ( io Float32 v[], in UInt32 o ) | |
get ? ( io Float64 v<> ) | |
get ? ( io Float64 v<>, in UInt32 o ) | |
get ? ( io Float64 v[] ) | |
get ? ( io Float64 v[], in UInt32 o ) | |
getTr ? ( io Float64 v<> ) | |
UInt32 | hash ? () |
Mat44 | inverse ? () |
Mat44 | inverse_safe ? () |
Boolean | isNull ? () |
Mat44 | multiply ? ( in Mat44 other ) |
Mat44 | multiplyScalar ? ( in Scalar other ) |
Vec3 | multiplyVector3 ? ( in Vec3 other ) |
Vec4 | multiplyVector4 ? ( in Vec4 other ) |
set ! ( in Float32 v<> ) | |
set ! ( in Float32 v<>, in UInt32 o ) | |
set ! ( in Float64 v<> ) | |
set ! ( in Float64 v<>, in UInt32 o ) | |
set ! ( in Scalar _00, in Scalar _01, in Scalar _02, in Scalar _03, in Scalar _10, in Scalar _11, in Scalar _12, in Scalar _13, in Scalar _20, in Scalar _21, in Scalar _22, in Scalar _23, in Scalar _30, in Scalar _31, in Scalar _32, in Scalar _33 ) | |
set ! ( in Vec3 translation, in Mat33 rotation, in Vec3 scaling ) | |
set ! ( in Vec3 translation, in Quat rotation, in Vec3 scaling ) | |
setColumns ! ( in Vec4 col0, in Vec4 col1, in Vec4 col2, in Vec4 col3 ) | |
setDiagonal ! ( in Scalar v ) | |
setDiagonal ! ( in Vec3 v ) | |
setDiagonal ! ( in Vec4 v ) | |
setFromMat33 ! ( in Mat33 m ) | |
setIdentity ! () | |
setNull ! () | |
setRotation ! ( in Quat q ) | |
setRows ! ( in Vec4 row0, in Vec4 row1, in Vec4 row2, in Vec4 row3 ) | |
setScaling ! ( in Vec3 v ) | |
setTr ! ( in Float64 v<> ) | |
setTranslation ! ( in Vec3 tr ) | |
setUpperLeft ! ( in Mat33 m ) | |
Mat44 | sphericalLinearInterpolate ? ( in Mat44 m2, in Scalar t ) |
Mat44 | subtract ? ( in Mat44 other ) |
Vec3 | translation ? () |
Mat44 | transpose ? () |
Mat33 | upperLeft ? () |
zeroTranslation ! () |
Methods in detail¶
copy constructor
Mat44 ( in Scalar _00, in Scalar _01, in Scalar _02, in Scalar _03, in Scalar _10, in Scalar _11, in Scalar _12, in Scalar _13, in Scalar _20, in Scalar _21, in Scalar _22, in Scalar _23, in Scalar _30, in Scalar _31, in Scalar _32, in Scalar _33 )
Constructor from scalars
Mat44 ( in Vec4 row0, in Vec4 row1, in Vec4 row2, in Vec4 row3 )
Constructor from vectors
Mat44 ()
Mat44 Mat44.add? ( in Mat44 other )
Overload method for the add operator
Returns the adjoint matrix of this matrix
Boolean Mat44.almostEqual? ( in Mat44 other )
Returns true if this matrix is almost the same as another one (using a default precision)
Boolean Mat44.almostEqual? ( in Mat44 other, in Scalar precision )
Returns true if this matrix is almost the same as another one (given a precision)
clone method
Mat44.decompose? ( out Vec3 scaling, out Mat33 rotation, out Vec3 translation )
Decompose the Mat44 into the scaling, rotation and translation components and return them in the provided io args.
scaling | Returns the decomposed scaling value of the Mat44 |
rotation | Returns the decomposed rotation value of the Mat44 |
translation | Returns the decomposed translation value of the Mat44 |
Returns the determinant of this matrix
Mat44 Mat44.divideScalar? ( in Scalar other )
Returns the division of this matrix and a scalar
Boolean Mat44.equal? ( in Mat44 other )
Returns true if this matrix is the same as another one
Getter as external float32 array
Mat44.get? ( io Float32 v<>, in UInt32 o )
Getter as external float32 array and an offset
Getter as float32 array
Mat44.get? ( io Float32 v[], in UInt32 o )
Getter as float32 array and an offset
Getter as external float64 array
Mat44.get? ( io Float64 v<>, in UInt32 o )
Getter as external float64 array and an offset
Getter as float64 array
Mat44.get? ( io Float64 v[], in UInt32 o )
Getter as float64 array and an offset
Mat44.getTr? ( io Float64 v<> )
Get to an external array, transposing in the process
Hash for this value
Returns the inverse matrix of this matrix
Returns the inverse matrix of this matrix, always checking the determinant value.
Boolean Mat44.isNull? ()
returns true if all components in this matrix are 0.0
Mat44 Mat44.multiply? ( in Mat44 other )
Overload method for the multiply operator
Mat44 Mat44.multiplyScalar? ( in Scalar other )
Returns the product of this matrix and a scalar
Vec3 Mat44.multiplyVector3? ( in Vec3 other )
Returns the product of this matrix and a Vec3
Vec4 Mat44.multiplyVector4? ( in Vec4 other )
Returns the product of this matrix and a Vec4
Setter from (standard/external) float32 array
Mat44.set! ( in Float32 v<>, in UInt32 o )
Setter from (standard/external) float32 array and an offset
Setter from (standard/external) float64 array
Mat44.set! ( in Float64 v<>, in UInt32 o )
Setter from (standard/external) float64 array and an offset
Mat44.set! ( in Scalar _00, in Scalar _01, in Scalar _02, in Scalar _03, in Scalar _10, in Scalar _11, in Scalar _12, in Scalar _13, in Scalar _20, in Scalar _21, in Scalar _22, in Scalar _23, in Scalar _30, in Scalar _31, in Scalar _32, in Scalar _33 )
Sets each component with a single scalar value.
Mat44.set! ( in Vec3 translation, in Mat33 rotation, in Vec3 scaling )
Mat44.set! ( in Vec3 translation, in Quat rotation, in Vec3 scaling )
Mat44.setColumns! ( in Vec4 col0, in Vec4 col1, in Vec4 col2, in Vec4 col3 )
Setter from vectors, column-wise
Mat44.setDiagonal! ( in Scalar v )
setting the diagonal components of this matrix to a scalar
Mat44.setDiagonal! ( in Vec3 v )
setting the diagonal components of this matrix to the components of a Vec3
Mat44.setDiagonal! ( in Vec4 v )
matrix to the components of a Vec4
Mat44.setFromMat33! ( in Mat33 m )
set the upper left 3 x 3 components from a Mat33. the remaining components are set to the identify matrix’s content.
Mat44.setIdentity! ()
setting this matrix to the identity matrix
Mat44.setNull! ()
setting all components of the matrix to 0.0
Mat44.setRotation! ( in Quat q )
set the upper left 3 x 3 components from a Quat.
注釈
This will replace all the upper left, including scaling components if there was
Mat44.setRows! ( in Vec4 row0, in Vec4 row1, in Vec4 row2, in Vec4 row3 )
Setter from vectors, row-wise
Mat44.setScaling! ( in Vec3 v )
Sets the scaling of the matrix by scaling the rows of the matrix.
注釈
This will preserve the existing matrix content
Mat44.setTr! ( in Float64 v<> )
Set from an external array, transposing in the process
Mat44.setTranslation! ( in Vec3 tr )
Sets the translation components of this matrix to a given Vec3
Mat44.setUpperLeft! ( in Mat33 m )
replaces the upper left 3 x 3 components from a Mat33.
Mat44 Mat44.sphericalLinearInterpolate? ( in Mat44 m2, in Scalar t )
interpolates two matrices spherically (slerp) given a scalar blend value (0.0 to 1.0).
Mat44 Mat44.subtract? ( in Mat44 other )
Overload method for the subtract operator
Returns the translation components of this matrix as a Vec3
Returns the transposed matrix of this matrix
Returns the upper left 3 x 3 components of this matrix as a Mat33
Mat44.zeroTranslation! ()
Sets the translation components of this matrix to 0.0