Matrix3
A 3x3 matrix. Arguments to set() and the constructor are in row-major order; elements is stored in column-major order.
Constructor
const m = new Matrix3() // identity
const m = new Matrix3(n11, n12, n13, n21, n22, n23, n31, n32, n33)
Properties
elements— Column-majorArray<number>(length 9)isMatrix3— Type flag (true)
Methods
Setting
set(n11..n33)— Set elements (row-major)identity()— Reset to identitycopy(m)— Copy from another Matrix3setFromMatrix4(m)— Extract upper 3x3 from Matrix4fromArray(array, offset?)— Set from column-major arrayclone()
Arithmetic
multiply(m)— Post-multiplypremultiply(m)— Pre-multiplymultiplyMatrices(a, b)— Multiply two matrices, store resultmultiplyScalar(s)— Scale all elements
Operations
determinant()— Compute determinantinvert()— Invert in-place (zero matrix if det=0)transpose()— Transpose in-placegetNormalMatrix(matrix4)— Compute normal matrix from 4x4 matrixtransposeIntoArray(r)— Transpose into external array
Basis & Transforms
extractBasis(xAxis, yAxis, zAxis)— Extract basis vectorssetUvTransform(tx, ty, sx, sy, rotation, cx, cy)— UV transformscale(sx, sy),rotate(theta),translate(tx, ty)— 2D transformsmakeTranslation(x, y),makeRotation(theta),makeScale(x, y)— Create 2D transform matrices
Other
equals(matrix)— Equality testtoArray(array?, offset?)— Write to column-major array