Creates and initializes the Matrix3 to the 3x3 identity matrix.
A column-major list of matrix values.
[1, 0, 0, 0, 1, 0, 0, 0, 1]
Read-only flag to check if a given object is of type Matrix.
Read-only flag to check if a given object is of type Matrix3.
Creates a new Matrix3 and with identical elements to this one.
A new instance.
Computes the determinant of this matrix.
A float.
Test if this instance is equivalent to another matrix.
True if this matrix and m are equal.
Extracts the basis of this matrix into the three axis vectors provided. If this matrix is:
a, b, c,
d, e, f,
g, h, i
then the xAxis, yAxis, zAxis will be set to:
xAxis = (a, d, g)
yAxis = (b, e, h)
zAxis = (c, f, i)
This instance.
Sets the elements of this matrix based on an array in column-major format.
This instance.
the array to read the elements from.
Optional
offset: number = 0index of first element in the array. Default is 0.
Resets this matrix to the 3x3 identity matrix:
1, 0, 0
0, 1, 0
0, 0, 1
This instance.
Inverts this matrix, using the analytic method. You can not invert with a determinant of zero. If you attempt this, the method produces a zero matrix instead.
This instance
Sets this matrix to a x b.
This instance.
Multiplies every component of the matrix by the scalar value s.
This instance.
Rotates this matrix by the given angle (in radians).
This instance.
The angle in radians to rotate
Scales this matrix with the given scalar values.
This instance.
x scale factor
y scale factor
Sets the 3x3 matrix values to the given row-major sequence of values.
This instance.
Set this matrix to the upper 3x3 matrix of the Matrix4 m.
This instance.
offset x
offset y
repeat x
repeat y
rotation in radians
center x of rotation
center y of rotation
Writes the elements of this matrix to an array in column-major format.
The array param or a new instance
Optional
array: number[] = []array to store the resulting vector in. If not given a new array will be created.
Optional
offset: number = 0offset in the array at which to put the result.
Translates this matrix by the given scalar values.
This instance.
The x direction translation
The y direction translation
Transposes this matrix in place.
This instance.
Transposes this matrix into the supplied array, and returns itself unchanged.
This instance.
array to store the resulting vector in.
A class representing a 3x3 matrix.
Example
Remark
A Note on Row-Major and Column-Major Ordering The set() method takes arguments in row-major order, while internally they are stored in the elements array in column-major order.
This means that calling
will result in the elements array containing:
and internally all calculations are performed using column-major ordering. However, as the actual ordering makes no difference mathematically and most people are used to thinking about matrices in row-major order, the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source code, you'll have to take the transpose of any matrices outlined here to make sense of the calculations.