-
Notifications
You must be signed in to change notification settings - 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
, aFloat32Array
or anotherMatrix4
which 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.
-
m11
m21
m31
m41
-
m12
m22
m32
m42
-
m13
m23
m33
m43
-
m14
m24
m34
m44
.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.
-
matrix
anarray, a
Float32Arrayor another
Matrix4` which datas will be copied from. -
offset
the offset to use to copy data (default 0).
setIdentity()
Set the matrix to its identity.
multiply( matrix )
Multiply the current matrix by another one.
-
matrix
anarray, a
Float32Arrayor another
Matrix4` 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.
-
translation
the translation to apply.
translateY(translation)
Translate the current matrix on the Y axis.
-
translation
the translation to apply.
translateZ(translation)
Translate the current matrix on the Z axis.
-
translation
the translation to apply.
translate(x, y, z)
Translate the current matrix on the X, Y and Z axis.
-
x
the translation to apply on X. -
y
the translation to apply on Y. -
z
the translation to apply on Z.
scaleX(scaling)
Scale the current matrix on the X axis.
-
scaling
the scale to apply.
scaleY(scaling)
Scale the current matrix on the Y axis.
-
scaling
the scale to apply.
scaleZ(scaling)
Scale the current matrix on the Z axis.
-
scaling
the scale to apply.
scale(x, y, z)
Scale the current matrix on X, Y and Z axis.
-
x
the scale to apply on X. -
y
the scale to apply on Y. -
z
the scale to apply on Z.
rotateX(angle)
Rotate the current matrix on the X axis.
-
angle
the angle to apply.
rotateY(angle)
Rotate the current matrix on the Y axis.
-
angle
the angle to apply.
rotateZ(angle)
Rotate the current matrix on the Z axis.
-
angle
the angle to apply.
rotate(x, y, z, order)
Rotate the current matrix on the X, Y and Z axis.
-
x
the angle to apply. -
y
the angle to apply. -
z
the angle to apply. -
order
the order to apply each angleXYZ
XZY
YXZ
YZX
ZXY
ZYX
rotateAround(x, y, z, angle)
Rotate the matrix around a point.
-
x
the X position of the point to rotate around. -
y
the Y position of the point to rotate around. -
z
the Z position of the point to rotate around. -
angle
the angle to apply.
clone()
Clone the current Matrix4 instance.