Creates a new Matrix3, defaulting to the identity matrix
Optionalelements: TypedFixedArray<9>
Optional column-major backing array of 9 floats, used as is rather than copied
AdvancedarrayThe array Matrix3#toArray writes into when given no out; null until its first call
The nine values, column by column: a 2D translation sits at indices 6 and 7
StaticIDENTITYA read-only identity matrix
This is a shared instance; do not mutate it. Use Matrix3.shared when you need a writable temporary.
StaticsharedA shared Matrix3, reset to identity on every access, for a one-off calculation
This matrix is shared and temporary. Do not store references to it.
Pixi-style alias for Matrix3#multiply: this = this * m
The matrix the result was written to
Alias for Matrix3#multiplyMatrices: this matrix becomes a * b
The matrix the result was written to
Copies the elements of m into this matrix
Matrix to copy from
This matrix
Checks whether all 9 elements of this matrix match m exactly, with no tolerance
Matrix to compare against
True when every element matches
Reads the 9 elements from array (column-major) starting at offset
Source array of column-major elements
Index of the first element to read
This matrix
Sets this matrix to the inverse of m
When m can't be inverted (its determinant is 0), the result is the identity and a warning is
logged.
The matrix the result was written to
Sets this matrix to the normal matrix of matrix4: the inverse transpose of its upper-left
3x3 block
Normals transformed by it stay at right angles to the surface when the model has non-uniform scale; renormalize them after. A matrix with zero scale on an axis gives the identity and logs a warning.
The matrix the result was written to
Advanced
Multiplies every element of this matrix by the scalar s
Scalar to multiply by
Optional target; defaults to writing into this matrix
The matrix the result was written to
Pixi-style alias for Matrix3#premultiply: this = m * this
The matrix the result was written to
Rotates this matrix by theta radians around the origin (2D affine)
The rotation applies after the existing transform, and a positive angle turns +x toward +y,
the same as pixi's Matrix.rotate.
Rotation angle in radians
Optional target; defaults to writing into this matrix
The matrix the result was written to
Scales this 2D transform by (sx, sy) about the origin, applied after the transform built so
far, like pixi's Matrix.scale
Scale along x
Scale along y
Optional target; defaults to writing into this matrix
The matrix the result was written to
Sets the 9 elements from arguments given row by row, as the matrix is written on paper
Row 1, column 1
Row 1, column 2
Row 1, column 3
Row 2, column 1
Row 2, column 2
Row 2, column 3
Row 3, column 1
Row 3, column 2
Row 3, column 3
This matrix
Sets this matrix to a UV transform: rotate by rotation and scale by (sx, sy), both about
(cx, cy), then offset by (tx, ty)
A positive rotation turns +u toward -v. The rotation applies before the scale, which is the
opposite of glTF's KHR_texture_transform, so the two disagree when the scale is non-uniform
and the rotation isn't zero. A material's UVs take a pixi Matrix in
BaseMaterial3D#uvTransform instead.
Translation along u
Translation along v
Scale along u
Scale along v
Rotation angle in radians
Rotation center u
Rotation center v
This matrix
Writes this matrix's elements into a Float32Array
Without out, writes into and returns Matrix3#array.
Optionaltranspose: boolean
true writes row-major instead of column-major
Optionalout: Float32Array<ArrayBufferLike>
Optional destination array
The populated array
Advanced
Formats this matrix as a readable row-by-row string
The string representation
Moves this 2D transform by (tx, ty), applied after the transform built so far, like pixi's
Matrix.translate
Translation along x
Translation along y
Optional target; defaults to writing into this matrix
The matrix the result was written to
Transposes this matrix
Optional target; defaults to writing into this matrix
The matrix the result was written to
A 3x3 matrix, for 2D affine transforms such as UV transforms, and for the normal matrix of a 3D transform
Matrix3#elements holds the nine values column by column, the order shaders use, and a
Matrix3can be the value of amat3x3<f32>uniform as it is. The 2D methods (Matrix3#translate, Matrix3#rotate, Matrix3#scale) each apply after the transform built so far, like pixi'sMatrix.Methods that change the matrix do so in place, or write into an
outmatrix when you pass one and leave this matrix as it is.Example