Matrix3
A class representing a 3x3 matrix|).
A class representing a 3x3 matrix.
Constructors
Constructor
new Matrix3():
Matrix3
Returns
Matrix3
Properties
isMatrix3
isMatrix3:
boolean
Check the type whether it belongs to Matrix3. This value should not be changed by user.
is2x3
is2x3:
boolean
If this value is true, then fast matrix operations can be used. If not, then we presume the matrix to the points needs to do some ‘fake’ 3d projection transforms.
Remarks
see multiplyMatrixFast for more detail
Accessors
elements
Get Signature
get elements():
Float32Array
A column-major list of matrix values.
Returns
Float32Array
Set Signature
set elements(
v):void
Deprecated
use fromArray instead;
Parameters
v
Float32Array
Returns
void
Methods
set()
set(
n11,n12,n13,n21,n22,n23,n31,n32,n33):Matrix3
Sets the 3x3 matrix values to the given row-major sequence of values.
Parameters
n11
number
value to put in row 1, col 1.
n12
number
value to put in row 1, col 2.
n13
number
n21
number
n22
number
n23
number
n31
number
n32
number
value to put in row 3, col 2.
n33
number
value to put in row 3, col 3.
Returns
Matrix3
identity()
identity():
Matrix3
Resets this matrix to the 3x3 identity matrix:
1, 0, 0 0, 1, 0 0, 0, 1#### Returns `Matrix3` *** ### clone() > **clone**(): `Matrix3` Creates a new Matrix3 and with identical elements to this one. #### Returns `Matrix3` *** ### cloneReadonly() > **cloneReadonly**(): `Readonly`\<`Pick`\<`ReadonlyMarked`, `"_readonly_mark"` \| `"cloneReadonly"` \| `"clone"` \| `"equals"` \| `"getSerializeData"` \| `"getNumberCount"` \| `"toArray"` \| `"elements"` \| `"applyToBufferAttribute"` \| `"determinant"` \| `"transposeIntoArray"` \| `"applyToArray"` \| `"applyInverse"` \| `"decompose"`\>\> #### Returns `Readonly`\<`Pick`\<`ReadonlyMarked`, `"_readonly_mark"` \| `"cloneReadonly"` \| `"clone"` \| `"equals"` \| `"getSerializeData"` \| `"getNumberCount"` \| `"toArray"` \| `"elements"` \| `"applyToBufferAttribute"` \| `"determinant"` \| `"transposeIntoArray"` \| `"applyToArray"` \| `"applyInverse"` \| `"decompose"`\>\> *** ### copy() > **copy**(`m`): `Matrix3` Copies the elements of matrix m into this matrix. #### Parameters ##### m `Matrix3` #### Returns `Matrix3` *** ### setFromMatrix4() > **setFromMatrix4**(`m`): `Matrix3` Set this matrix to the upper 3x3 matrix of the Matrix4 [m](/en-US/api/math/classes/matrix-4/). #### Parameters ##### m [`Matrix4`](/en-US/api/math/classes/matrix-4/) #### Returns `Matrix3` *** ### applyToBufferAttribute() > **applyToBufferAttribute**(`attribute`, `__forceJSImpl?`): [`BufferAttribute`](/en-US/api/core/classes/buffer-attribute/) Apply this matrix to given [attribute buffer](/en-US/api/core/classes/buffer-attribute/). #### Parameters ##### attribute [`BufferAttribute`](/en-US/api/core/classes/buffer-attribute/) ##### \_\_forceJSImpl? `boolean` #### Returns [`BufferAttribute`](/en-US/api/core/classes/buffer-attribute/) *** ### multiply() > **multiply**(`m`): `Matrix3` Post-multiplies this matrix by m. #### Parameters ##### m `Matrix3` #### Returns `Matrix3` *** ### premultiply() > **premultiply**(`m`): `Matrix3` Pre-multiplies this matrix by m. #### Parameters ##### m `Matrix3` #### Returns `Matrix3` *** ### multiplyMatrices() > **multiplyMatrices**(`a`, `b`): `Matrix3` Sets this matrix to a x b. #### Parameters ##### a `Matrix3` ##### b `Matrix3` #### Returns `Matrix3` *** ### addMatrices() > **addMatrices**(`a`, `b`): `Matrix3` #### Parameters ##### a `Matrix3` ##### b `Matrix3` #### Returns `Matrix3` *** ### multiplyScalar() > **multiplyScalar**(`s`): `Matrix3` Multiplies every component of the matrix by the scalar value `s`. #### Parameters ##### s `number` #### Returns `Matrix3` *** ### determinant() > **determinant**(): `number` Computes and returns the [determinant](https://en.wikipedia.org/wiki/Determinant|) of this matrix. #### Returns `number` *** ### getInverse() > **getInverse**(`matrix`, `throwOnDegenerate?`): `Matrix3` Return the inverse matrix of given matrix. #### Parameters ##### matrix `Matrix3` ##### throwOnDegenerate? `boolean` #### Returns `Matrix3` *** ### transpose() > **transpose**(): `Matrix3` Return the transpose matrix of this. #### Returns `Matrix3` *** ### getNormalMatrix() > **getNormalMatrix**(`matrix4`): `Matrix3` Sets this matrix as the upper left 3x3 of the [normal matrix](https://en.wikipedia.org/wiki/Normal_matrix|) of the passed [matrix4](/en-US/api/math/classes/matrix-4/). The normal matrix is the [inverse](https://en.wikipedia.org/wiki/Invertible_matrix|) [transpose](https://en.wikipedia.org/wiki/Transpose) of the matrix [m](/en-US/api/math/classes/matrix-4/). #### Parameters ##### matrix4 [`Matrix4`](/en-US/api/math/classes/matrix-4/) #### Returns `Matrix3` *** ### transposeIntoArray() > **transposeIntoArray**(`r`): `Matrix3` Transpose this matrix into the supplied array, and returns itself unchanged. #### Parameters ##### r `Matrix3` #### Returns `Matrix3` *** ### setUVTransform() > **setUVTransform**(`tx`, `ty`, `sx`, `sy`, `rotation`, `cx`, `cy`): `void` Build transform matrix. #### Parameters ##### tx `number` A translate add to u. ##### ty `number` ##### sx `number` Scale multiply to u. ##### sy `number` Scale multiply to v. ##### rotation `number` A rotation apply to u and v. ##### cx `number` Translate u influenced by same rotation. ##### cy `number` Translate v influenced by same rotation. #### Returns `void` *** ### scale() > **scale**(`sx`, `sy`): `Matrix3` Apply a scale on this matrix. #### Parameters ##### sx `number` scale the value of first row. ##### sy `number` scale the value of second row. #### Returns `Matrix3` *** ### rotate() > **rotate**(`theta`): `Matrix3` Apply a rotation on this matrix. #### Parameters ##### theta `number` a value in radius. #### Returns `Matrix3` *** ### translate() > **translate**(`tx`, `ty`): `Matrix3` Apply a translation to this matrix. #### Parameters ##### tx `number` translate first row by tx. ##### ty `number` translate second row by ty. #### Returns `Matrix3` *** ### equals() > **equals**(`matrix`): `boolean` Return true if this matrix and m are equal. #### Parameters ##### matrix `Matrix3` #### Returns `boolean` *** ### apply() > **apply**(`pos`, `newPos?`): [`Vector2`](/en-US/api/math/classes/vector-2/) Apply this matrix on vector pos, and store the result in newPos (if it is given) or as return. #### Parameters ##### pos [`Vector2`](/en-US/api/math/classes/vector-2/) ##### newPos? [`Vector2`](/en-US/api/math/classes/vector-2/) #### Returns [`Vector2`](/en-US/api/math/classes/vector-2/) *** ### applyToArray() > **applyToArray**(`array`): `Float32Array` Apply this matrix on given array. Each vector item of array should hold three elements. #### Parameters ##### array `Float32Array` #### Returns `Float32Array` *** ### applyInverse() > **applyInverse**(`pos`, `newPos?`): [`Vector2`](/en-US/api/math/classes/vector-2/) Apply this matrix's inverse on vector pos, and store the result in newPos (if it is given) or as return. #### Parameters ##### pos [`Vector2`](/en-US/api/math/classes/vector-2/) ##### newPos? [`Vector2`](/en-US/api/math/classes/vector-2/) #### Returns [`Vector2`](/en-US/api/math/classes/vector-2/) *** ### fromArray() > **fromArray**(`array`, `offset?`): `Matrix3` Sets the elements of this matrix based on an array in column-major format. #### Parameters ##### array `ArrayLike`\<`number`\> the array to read the elements from. ##### offset? `number` (optional) index of first element in the array. #### Returns `Matrix3` #### Default Value `0`. *** ### getNumberCount() > **getNumberCount**(): `number` There are 9 elements in this matrix. #### Returns `number` *** ### toArray() > **toArray**(`array?`, `offset?`): `number`[] Writes the elements of this matrix to an array in column-major format. #### Parameters ##### array? `number`[] (optional) array to store the resulting vector in. If not given a new array will be created. ##### offset? `number` (optional) offset in the array at which to put the result. #### Returns `number`[] *** ### toStd140Array() > **toStd140Array**(`array?`, `offset?`): `number`[] #### Parameters ##### array? `number`[] ##### offset? `number` #### Returns `number`[] *** ### compose() > **compose**(`x`, `y`, `pivotX`, `pivotY`, `scaleX`, `scaleY`, `rotation`, `skewX`, `skewY`): `this` Sets the matrix based on all the available properties. #### Parameters ##### x `number` Position on the x axis. ##### y `number` Position on the y axis. ##### pivotX `number` Pivot on the x axis. ##### pivotY `number` Pivot on the y axis. ##### scaleX `number` Scale on the x axis. ##### scaleY `number` Scale on the y axis. ##### rotation `number` Rotation in radians. ##### skewX `number` Skew on the x axis. ##### skewY `number` Skew on the y axis. #### Returns `this` This matrix. Good for chaining method calls. *** ### decompose() > **decompose**(): `object` Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform. #### Returns `object` The transform with the newly applied properties. ##### x > **x**: `number` ##### y > **y**: `number` ##### scaleX > **scaleX**: `number` ##### scaleY > **scaleY**: `number` ##### rotation > **rotation**: `number` ##### skewX > **skewX**: `number` ##### skewY > **skewY**: `number` *** ### makeOrthographic() > **makeOrthographic**(`left`, `right`, `top`, `bottom`): `Matrix3` Return an orthogonal projection matrix which is set by parameter. #### Parameters ##### left `number` ##### right `number` ##### top `number` ##### bottom `number` #### Returns `Matrix3` #### Remarks See OrthographicCamera \| OrthographicCamera for more details. *** ### multiplyMatrixFast() > `static` **multiplyMatrixFast**(`a`, `b`, `result`): `Matrix3` This multiplication is specifically used for 2x3 matrixes calculation. #### Parameters ##### a `Matrix3` ##### b `Matrix3` ##### result `Matrix3` #### Returns `Matrix3`