Package: graphene
CStruct graphene:matrix-t
Details
The graphene:matrix-t structure is a type that provides a 4x4
square matrix, useful for representing 3D transformations. The matrix is treated as row-major, that is, it has four vectors x, y, z, and w representing rows, and elements of each
vector are a column:
The contents of a graphene:matrix-t instance are private, and direct access is not possible. You can modify and read the contents of a graphene:matrix-t instance only through the provided API.
⎡ m.x ⎤ ⎛ x.x x.y x.z x.w ⎞ ⎜ m.y ⎟ => ⎜ y.x y.y y.z y.w ⎟ ⎜ m.z ⎟ ⎜ z.x z.y z.z z.w ⎟ ⎣ m.w ⎦ ⎝ w.x w.y w.z w.w ⎠It is possible to easily convert a graphene:matrix-t instance to and from an array of floating point values that can be used with other libraries.
The contents of a graphene:matrix-t instance are private, and direct access is not possible. You can modify and read the contents of a graphene:matrix-t instance only through the provided API.
Conventions
Graphene uses left-multiplication for all its operations on vectors and matrices. In other words, given a matrix A and a vector b, the result of a multiplication is going to be:res = b × AMultiplying two matrices, on the other hand, will use right-multiplication. Given two matrices A and B, the result of the multiplication is going to be
res = A × Bas the implementation will multiply each row vector of matrix A with the matrix B to obtain the new row vectors of the result matrix:
res = ⎡ A.x × B ⎤ ⎜ A.y × B ⎟ ⎜ A.z × B ⎟ ⎣ A.w × B ⎦
#2024-12-30