Math module

Matrix3

structSource

A 3x3 matrix, row-major: _11 to _33, also v[row] as Vector3 rows, coef[row][col] and floats[9]. Matrix3 * Vector3 multiplies by a column vector, Matrix3 * Matrix3 is the product, and +, - and * float work element by element. A rotation matrix of a quaternion is made by rotation_matrix(Matrix3, q).

ExampleOpen in playground ↗
m := Matrix3_Identity;
m._13 = 5; // row 1, column 3
assert(m.v[0] == xyz(1, 0, 5) && m.coef[0][2] == 5 && m.floats[2] == 5);
assert(m * xyz(1, 1, 1) == xyz(6, 1, 1));

Fields

_11: float
_12: float
_13: float
_21: float
_22: float
_23: float
_31: float
_32: float
_33: float
v: [3] Vector3
coef: [3][3] float
floats: [9] float

See also