Matrix3
A class representing a 3x3 matrix.
Properties
is Matrix3
Check the type whether it belongs to Matrix3. This value should not be changed by user.
is2x3
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 elements(): Float32Array
A column-major list of matrix values.
Returns Float32Array
- set elements(v: Float32Array): void
Methods
set
- set(
n11: number,
n12: number,
n13: number,
n21: number,
n22: number,
n23: number,
n31: number,
n32: number,
n33: number,
): Matrix3Sets 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
- n11: number
identity
Resets this matrix to the 3x3 identity matrix:
1, 0, 0 0, 1, 0 0, 0, 1Returns Matrix3
clone
Creates a new Matrix3 and with identical elements to this one.
Returns Matrix3
clone Readonly
- 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
set From Matrix4
apply To Buffer Attribute
Apply this matrix to given attribute buffer.
Parameters
- attribute: BufferAttribute
- __forceJSImpl: boolean
Returns BufferAttribute
multiply
premultiply
multiply Matrices
add Matrices
multiply Scalar
determinant
Computes and returns the determinant of this matrix.
Returns number
get Inverse
transpose
Return the transpose matrix of this.
Returns Matrix3
get Normal Matrix
transpose Into Array
set UV Transform
- setUVTransform(
tx: number,
ty: number,
sx: number,
sy: number,
rotation: number,
cx: number,
cy: number,
): voidBuild 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
- tx: number
scale
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
- sx: number
rotate
translate
Apply a translation to this matrix.
Parameters
- tx: number
translate first row by tx.
- ty: number
translate second row by ty.
Returns Matrix3
- tx: number
equals
apply
apply To Array
Apply this matrix on given array. Each vector item of array should hold three elements.
Parameters
- array: Float32Array
Returns Float32Array
apply Inverse
from Array0
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
- array: ArrayLike<number>
get Number Count
There are 9 elements in this matrix.
Returns number
to Array
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[]
- array: number[]
to Std140 Array
Parameters
- array: number[]
- offset: number
Returns number[]
compose
- compose(
x: number,
y: number,
pivotX: number,
pivotY: number,
scaleX: number,
scaleY: number,
rotation: number,
skewX: number,
skewY: number,
): thisSets 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.
- x: number
decompose
- decompose(): {
x: number;
y: number;
scaleX: number;
scaleY: number;
rotation: number;
skewX: number;
skewY: number;
}Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.
Returns {
x: number;
y: number;
scaleX: number;
scaleY: number;
rotation: number;
skewX: number;
skewY: number;
}The transform with the newly applied properties.
make Orthographic
Return an orthogonal projection matrix which is set by parameter.
Parameters
- left: number
- right: number
- top: number
- bottom: number
Returns Matrix3
Remarks
See OrthographicCamera for more details.
A class representing a 3x3 matrix.