-
Couldn't load subscription status.
- Fork 0
Matrix4
The Matrix4 is the must commonly used matrix for 3D.
import { Matrix4 } from "noobgl-matrix";new Matrix4(matrix);-
matrix(optional) may be anarray, aFloat32Arrayor anotherMatrix4which datas will be copied from.
Here is the map of the Matrix4:
11 21 31 41
12 22 32 42
13 23 33 43
14 24 34 44.array the Float32Array containing matrix datas.
.mXY (get) shortcuts to access .array datas.
-
m11m21m31m41 -
m12m22m32m42 -
m13m23m33m43 -
m14m24m34m44
.determinant (get) the current determinant of the matrix.
.invertedDeterminant (get) the current inverted determinant of the matrix.
.scaling (get) the current scaling of the matrix.
.rotation (get) the current rotation of the matrix.
set(matrix, offset)Set the .array by copying datas.
-
matrixanarray, aFloat32Arrayor anotherMatrix4` which datas will be copied from. -
offsetthe offset to use to copy data (default 0).
setIdentity()Set the matrix to its identity.
multiply( matrix )Multiply the current matrix by another one.
-
matrixanarray, aFloat32Arrayor anotherMatrix4` which datas will be multiplied with.
inverse()Inverse the current matrix if the .determinant allow it.
transpose()Transpose the current matrix.
translateX(translation)Translate the current matrix on the X axis.
-
translationthe translation to apply.
translateY(translation)Translate the current matrix on the Y axis.
-
translationthe translation to apply.
translateZ(translation)Translate the current matrix on the Z axis.
-
translationthe translation to apply.
translate(x, y, z)Translate the current matrix on the X, Y and Z axis.
-
xthe translation to apply on X. -
ythe translation to apply on Y. -
zthe translation to apply on Z.
scaleX(scaling)Scale the current matrix on the X axis.
-
scalingthe scale to apply.
scaleY(scaling)Scale the current matrix on the Y axis.
-
scalingthe scale to apply.
scaleZ(scaling)Scale the current matrix on the Z axis.
-
scalingthe scale to apply.
scale(x, y, z)Scale the current matrix on X, Y and Z axis.
-
xthe scale to apply on X. -
ythe scale to apply on Y. -
zthe scale to apply on Z.
rotateX(angle)Rotate the current matrix on the X axis.
-
anglethe angle to apply.
rotateY(angle)Rotate the current matrix on the Y axis.
-
anglethe angle to apply.
rotateZ(angle)Rotate the current matrix on the Z axis.
-
anglethe angle to apply.
rotate(x, y, z, order)Rotate the current matrix on the X, Y and Z axis.
-
xthe angle to apply. -
ythe angle to apply. -
zthe angle to apply. -
orderthe order to apply each angleXYZXZYYXZYZXZXYZYX
rotateAround(x, y, z, angle)Rotate the matrix around a point.
-
xthe X position of the point to rotate around. -
ythe Y position of the point to rotate around. -
zthe Z position of the point to rotate around. -
anglethe angle to apply.
clone()Clone the current Matrix4 instance.