Matrix4
Core.Matrix4 exported from @manycore/aholo-viewer.
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,
n14: number,
n21: number,
n22: number,
n23: number,
n24: number,
n31: number,
n32: number,
n33: number,
n34: number,
n41: number,
n42: number,
n43: number,
n44: number,
): Matrix4
identity
Resets this matrix to the identity matrix.
Returns Matrix4
clone
clone Readonly
- cloneReadonly(): Readonly<
Pick<
ReadonlyMarked,
| "_readonly_mark"
| "cloneReadonly"
| "clone"
| "equals"
| "getSerializeData"
| "getNumberCount"
| "toArray"
| "elements"
| "applyToBufferAttribute"
| "determinant"
| "applyToArray"
| "decompose"
| "extractBasis"
| "getPosition"
| "getMaxScaleOnAxis"
| "decompose2D",
>,
>Returns Readonly<
Pick<
ReadonlyMarked,
| "_readonly_mark"
| "cloneReadonly"
| "clone"
| "equals"
| "getSerializeData"
| "getNumberCount"
| "toArray"
| "elements"
| "applyToBufferAttribute"
| "determinant"
| "applyToArray"
| "decompose"
| "extractBasis"
| "getPosition"
| "getMaxScaleOnAxis"
| "decompose2D",
>,
>
copy
copy Position
extract Basis
make Basis
extract Rotation
make Rotation From Euler
Sets the rotation component (the upper left 3x3 matrix) of this matrix to the rotation specified by the given euler. The rest of the matrix is set to the identity. Depending on the order of the euler, there are six possible outcomes.
Parameters
- euler: Euler
Returns Matrix4
Remarks
See this page for a complete list.
make Rotation From Quaternion
Sets the rotation component of this matrix to the rotation specified by q, as outlined here. The rest of the matrix is set to the identity. So, given q = w + xi + yj + zk, the resulting matrix will be:
1-2y²-2z² 2xy-2zw 2xz+2yw 0 2xy+2zw 1-2x²-2z² 2yz-2xw 0 2xz-2yw 2yz+2xw 1-2x²-2y² 0 0 0 0 1
Parameters
- q: Quaternion
Returns Matrix4
look At
multiply
premultiply
multiply Matrices
multiply Scalar
apply To Buffer Attribute
Apply this matrix to given attribute buffer.
Parameters
- attribute: BufferAttribute
- __forceJSImpl: boolean
Returns BufferAttribute
apply To Array
Apply this matrix on given array. Each vector item of array should hold three elements.
Parameters
- array: Float32Array
Returns Float32Array
determinant
Computes and returns the determinant of this matrix. Based on the method outlined here.
Returns number
transpose
Transposes this matrix.
Returns Matrix4
set Position
get Position
get Inverse
scale
get Scale
translate
Apply a translation to this matrix.
Parameters
- tx: number
translate first row by tx.
- ty: number
translate second row by ty.
- tz: number
Returns Matrix4
- tx: number
get Max Scale On Axis
Gets the maximum scale value of the 3 axes.
Returns number
make Translation
Sets this matrix as a translation transform:
1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1
Parameters
- x: number
the amount to translate in the X axis.
- y: number
the amount to translate in the Y axis.
- z: number
the amount to translate in the Z axis.
Returns Matrix4
- x: number
make Rotation X
Sets this matrix as a rotational transformation around the X axis by Float| theta (θ) radians. The resulting matrix will be:
1 0 0 0 0 cos(θ) -sin(θ) 0 0 sin(θ) cos(θ) 0 0 0 0 1
Parameters
- theta: number
Rotation angle in radians.
Returns Matrix4
- theta: number
make Rotation Y
Sets this matrix as a rotational transformation around the Y axis by Float| theta (θ) radians. The resulting matrix will be:
cos(θ) 0 sin(θ) 0 0 1 0 0 -sin(θ) 0 cos(θ) 0 0 0 0 1Parameters
- theta: number
Rotation angle in radians.
Returns Matrix4
- theta: number
make Rotation Z
Sets this matrix as a rotational transformation around the Z axis by Float| theta (θ) radians. The resulting matrix will be:
cos(θ) -sin(θ) 0 0 sin(θ) cos(θ) 0 0 0 0 1 0 0 0 0 1Parameters
- theta: number
Rotation angle in radians.
Returns Matrix4
- theta: number
make Rotation Axis
Sets this matrix as rotation transform around axis by Float| theta radians.
This is a somewhat controversial but mathematically sound alternative to rotating via Quaternions| Quaternions.Parameters
- axis: Vector3
Rotation axis, should be normalized.
- angle: number
Returns Matrix4
Remarks
See the discussion here.
- axis: Vector3
make Scale
Parameters
- x: number
the amount to scale in the X axis.
- y: number
the amount to scale in the Y axis.
- z: number
the amount to scale in the Z axis. Sets this matrix as scale transform:
x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1
Returns Matrix4
- x: number
make Shear
Parameters
- x: number
the amount to shear in the X axis.
- y: number
the amount to shear in the Y axis.
- z: number
the amount to shear in the Z axis. Sets this matrix as a shear transform:
1, y, z, 0, x, 1, z, 0, x, y, 1, 0, 0, 0, 0, 1
Returns Matrix4
- x: number
compose
Sets this matrix to the transformation composed of position, quaternion and scale.
Parameters
- position: Vector3
- quaternion: Quaternion
- scale: Vector3
Returns Matrix4
decompose
Decomposes this matrix into it's position, quaternion and scale components.
Parameters
- position: Vector3
- quaternion: Quaternion
- scale: Vector3
Returns Matrix4
compose2 D
- compose2D(
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
decompose2 D
- decompose2D(): {
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 Perspective
- makePerspective(
left: number,
right: number,
top: number,
bottom: number,
near: number,
far: number,
): Matrix4Creates a perspective projection matrix. This is used internally by PerspectiveCamera.updateProjectionMatrix| PerspectiveCamera.updateProjectionMatrix()
Parameters
- left: number
- right: number
- top: number
- bottom: number
- near: number
- far: number
Returns Matrix4
make Orthographic
- makeOrthographic(
left: number,
right: number,
top: number,
bottom: number,
near: number,
far: number,
): Matrix4Creates an orthographic projection matrix. This is used internally by OrthographicCamera.updateProjectionMatrix| OrthographicCamera.updateProjectionMatrix().
Parameters
- left: number
- right: number
- top: number
- bottom: number
- near: number
- far: number
Returns Matrix4
transform Vector2
equals
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 ) offset into the array.
Returns Matrix4
- array: ArrayLike<number>
get Number Count
There are 16 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.
- offset: number
(optional) offset in the array at which to put the result.
Returns number[]
- array: number[]
Check the type whether it belongs to Matrix4. This value should not be changed by user.