Creates a new Matrix4x4. Accepts any arguments that RS.Math.Matrix4x4#set accepts.
Name | Type | Description |
---|---|---|
initial |
RS.Math.Matrix4x4 | Array | Object | Number |
optional
initial value. |
Example
let m = new RS.Math.Matrix4x4();
m = new RS.Math.Matrix4x4(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44);
m = new RS.Math.Matrix4x4([11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44]);
m = new RS.Math.Matrix4x4([
[11, 12, 13, 14],
[21, 22, 23, 24],
[31, 32, 33, 34],
[41, 42, 43, 44]
]);
m = new RS.Math.Matrix4x4({
xx:11, xy: 12, xz: 13, xw: 14,
yx:21, yy: 22, yz: 23, yw: 24,
zx:31, zy: 32, zz: 33, zw: 34,
wx:41, wy: 42, wz: 43, ww: 44
});
Members
-
The ww component of the vector
-
The wx component of the vector
-
The wy component of the vector
-
The wz component of the vector
-
The xw component of the vector
-
The xx component of the vector
-
The xy component of the vector
-
The xz component of the vector
-
The yw component of the vector
-
The yx component of the vector
-
The yy component of the vector
-
The yz component of the vector
-
The zw component of the vector
-
The zx component of the vector
-
The zy component of the vector
-
The zz component of the vector
Methods
-
Clear this matrix by setting all elements to 0.
-
clone ()RS.Math.Matrix4x4
-
Returns a copy of this matrix.
Returns:
Type Description RS.Math.Matrix4x4 -
Returns whether this matrix is equal to another matrix.
Name Type Description rhs
RS.Math.Matrix4x4 the matrix to compare to
tolerance
Number optional if provided then this level of tolerance is used.
Returns:
Type Description Boolean true
if equal,false
if not -
Returns whether this matrix is equal to another matrix within a tolerance.
Name Type Description rhs
RS.Math.Matrix4x4 the matrix to compare to
tolerance
Number optional if provided then this level of tolerance is used, otherwise tolerance is
10e-5
Returns:
Type Description Boolean true
if equal,false
if not -
Returns the determinant of this matrix.
Returns:
Type Description Number -
invert ()RS.Math.Matrix4x4
-
Sets this matrix to it's inverse. Throws if the matrix cannot be inverted.
Returns:
Type Description RS.Math.Matrix4x4 this -
multiply (matrix)RS.Math.Matrix4x4
-
Multiples another matrix on the left side of this matrix. Equivalent to this =
matrix * this
Name Type Description matrix
RS.Math.Matrix4x4 The matrix on the left hand side of the multiplication
Returns:
Type Description RS.Math.Matrix4x4 this -
Sets this matrix. The source may be of the following types:
- RS.Math.Matrix4x4
- an
Array
with 16 or moreNumber
members which will set the matrix in row major order. - an
Array
of 4 or moreArray
members (each of length 4 or more) which will set the rows of the matrix. - an
Object
. - a single
Number
which will set the array diagonal to that value. - 16 or more individual
Numbers
which will set the matrix in row major order.
In the case of an object being supplied it should have the members
xx
,xy
,xz
,xw
,yx
,yy
,yz
,yw
,zx
,zy
,zz
,zw
,wx
,wy
,wz
,ww
.Name Type Description source
RS.Math.Matrix4x4 | Array | Object | Number the object to set from or a set of numbers.
Example
const m = new RS.Math.Matrix4x4(); m.set(1); // sets the identify matrix // the following are equivalent m.set(11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44); m.set([11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44]); m.set([[11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34], [41, 42, 43, 44]]); m.set({xx:11, xy:12, xz:13, wz:14, yx:21, yy:22, yz:23, yw:24, zx:31, zy:32, zz:33, zw:34, wx:41, wy:42, wz:43, ww:44});
-
Sets this matrix to the identity matrix.
-
Sets this matrix to be a rotation matrix.
Name Type Description axis
RS.Math.Vector4 | RS.Math.Vector3 The vector to rotate around.
angle
Number The angle to rotate around the axis in radians.
-
Sets this matrix to a scaling matrix.
Name Type Description 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 the translation elements of this matrix while leaving the rest of the matrix untouched.
Name Type Description x
Number The x value
y
Number The y value
z
Number The z value
-
Returns a string describing this Object.
Returns:
Type Description String A String describing this Object. -
Increases the translation elements of this matrix while leaving the rest of the matrix untouched.
Name Type Description dx
Number The x value to add
dy
Number The y value to add
dz
Number The z value to add
-
transpose ()RS.Math.Matrix4x4
-
Sets this matrix to it's transpose.
Returns:
Type Description RS.Math.Matrix4x4 this