Builds a new Matrix4 from the following memory layout.
If you consider the matrix vector multiplication in line (V' = V x M), then the following matrix is built (translation [T0,T1,T2] on the bottom) :
| a | b | c | 0 (d) |
| e | f | g | 0 (h) |
| i | j | k | 0 (l) |
| T0 : m | T1 : n | T2 : o | 1 (p) |
| a | e | i | T0 : m |
| b | f | j | T1 : n |
| c | g | k | T2 : o |
| 0 (d) | 0 (h) | 0 (l) | 1 (p) |
Optional a: numberOptional b: numberOptional c: numberOptional d: numberOptional e: numberOptional f: numberOptional g: numberOptional h: numberOptional i: numberOptional j: numberOptional k: numberOptional l: numberOptional m: numberOptional n: numberOptional o: numberOptional p: numberThe newly created Matrix4.
A 16 float array that contains the values of the matrix.
Tells if the two matrices are strictly identical.
true if the two matrices are strictly identical.
Sets the content of the Matrix4 from a former call to toJSON.
true if the data is set.
Gets the pColum th "column" of the matrix.
This function actually takes the column if the Matrix vector multiplication is in column : V' = M x V .
If you consider the matrix vector multiplication in column (V' = M x V, translation [T0,T1,T2] on the right) :
| a | e | i | T0 : m |
| b | f | j | T1 : n |
| c | g | k | T2 : o |
| 0 (d) | 0 (h) | 0 (l) | 1 (p) |
If you consider the matrix vector multiplication in line (V' = V x M, translation [T0,T1,T2] on the bottom) :
| a | b | c | 0 (d) |
| e | f | g | 0 (h) |
| i | j | k | 0 (l) |
| T0 : m | T1 : n | T2 : o | 1 (p) |
No check is done to ensure pColumn is in the range [0-3].
pOut.
Computes the composition of this and the matrix represented by the values Mval and stores the result in pOut.
Any point P transformed by the resulting transformation will first be multiplied by this, and then Mval.
Be P' the transformed point of P :
Depending on your convention : P' = Mval x this x P (hence multiply left)
or P' = P x this x Mval.
If pOut is omitted, the result is stored in this.
If you consider the matrix vector multiplication in line (V' = V x Mval), then Mval is set to (translation [T0,T1,T2] on the bottom) :
| a | b | c | 0 (d) |
| e | f | g | 0 (h) |
| i | j | k | 0 (l) |
| T0 : m | T1 : n | T2 : o | 1 (p) |
| a | e | i | T0 : m |
| b | f | j | T1 : n |
| c | g | k | T2 : o |
| 0 (d) | 0 (h) | 0 (l) | 1 (p) |
this.multiplyMatrixLeft(pSecondTransform, pOut);
this.multiplyLeft(
pSecondTransform.array[0], pSecondTransform.array[1], pSecondTransform.array[2], pSecondTransform.array[3],
pSecondTransform.array[4], pSecondTransform.array[5], pSecondTransform.array[6], pSecondTransform.array[7],
pSecondTransform.array[8], pSecondTransform.array[9], pSecondTransform.array[10], pSecondTransform.array[11],
pSecondTransform.array[12], pSecondTransform.array[13], pSecondTransform.array[14], pSecondTransform.array[15],
pOut
);
Optional pOut: Matrix4pOut.
Computes the composition of this and pSecondTransform and stores the result in pOut.
Any point P transformed by the resulting transformation will first be multiplied by this, and then pSecondTransform.
Be P' the transformed point of P :
Depending on your convention : P' = pSecondTransform x this x P (hence multiply left)
or P' = P x this x pSecondTransform.
If pOut is omitted, the result is stored in this.
pOut.
Computes the composition of pFirstTransform and this and stores the result in pOut.
Any point P transformed by the resulting transformation will first be multiplied by pFirstTransform, and then this.
Be P' the transformed point of P :
Depending on your convention : P' = this x pFirstTransform x P (hence multiply right)
or P' = P x pFirstTransform x this.
If pOut is omitted, the result is stored in this.
pOut.
Computes the composition of the matrix represented by the values Mval and this and stores the result in pOut.
Any point P transformed by the resulting transformation will first be multiplied by Mval, and then this.
Be P' the transformed point of P :
Depending on your convention : P' = this x Mval x P (hence multiply right)
or P' = P x Mval x this.
If pOut is omitted, the result is stored in this.
If you consider the matrix vector multiplication in line (V' = V x Mval), then Mval is set to (translation [T0,T1,T2] on the bottom) :
| a | b | c | 0 (d) |
| e | f | g | 0 (h) |
| i | j | k | 0 (l) |
| T0 : m | T1 : n | T2 : o | 1 (p) |
| a | e | i | T0 : m |
| b | f | j | T1 : n |
| c | g | k | T2 : o |
| 0 (d) | 0 (h) | 0 (l) | 1 (p) |
this.multiplyMatrixRight(pFirstTransform, pOut);
this.multiplyRight(
pFirstTransform.array[0], pFirstTransform.array[1], pFirstTransform.array[2], pFirstTransform.array[3],
pFirstTransform.array[4], pFirstTransform.array[5], pFirstTransform.array[6], pFirstTransform.array[7],
pFirstTransform.array[8], pFirstTransform.array[9], pFirstTransform.array[10], pFirstTransform.array[11],
pFirstTransform.array[12], pFirstTransform.array[13], pFirstTransform.array[14], pFirstTransform.array[15],
pOut
);
Optional pOut: Matrix4pOut.
Computes the transformation of the vector pDirection by this matrix, and stores the result in pOut.
pDirection is considered a direction and thus, this is equivalent to using
multiplyVector4XYZW(pPoint[0],pPoint[1],pPoint[2],0).
If pOut is omitted, then pDirection is changed in place.
Returns pOut.
pOut.
Computes the transformation of the vector (pX,pY,pZ) by this matrix, and stores the result in pOut.
(pX,pY,pZ) is considered a direction and thus, this is equivalent to using multiplyVector4XYZW(pX,pY,pZ,0).
Returns pOut.
x coordinate of the vector3 to transform.y coordinate of the vector3 to transform.z coordinate of the vector3 to transform.pOut.
Computes the transformation of the vector pPoint by this matrix, and stores the result in pOut.
pPoint is considered a point and thus, this is equivalent to using
multiplyVector4XYZW(pPoint[0],pPoint[1],pPoint[2],1), and computing the homogeneous coordinates of the
resulting Vector4 (i.e. dividing all coordinates by the w coordinate of the vector4).
If pOut is omitted, then pPoint is changed in place.
Returns pOut.
pOut.
Computes the transformation of the vector (pX,pY,pZ) by this matrix, and stores the result in pOut.
The vector (pX,pY,pZ) is considered a point and thus, this is equivalent to using multiplyVector4XYZW(pX,pY,pZ,1), and computing the homogeneous coordinates of the resulting Vector4 (i.e. dividing all coordinates by the w coordinate of the vector4).
Returns pOut.
x coordinate of the vector3 to transform.y coordinate of the vector3 to transform.z coordinate of the vector3 to transform.pOut.
Computes the transformation of the vector (pX,pY,pZ,pW) by this matrix, and stores the result in pOut.
Returns pOut.
x coordinate of the vector4 to transform.y coordinate of the vector4 to transform.z coordinate of the vector4 to transform.w coordinate of the vector4 to transform.pOut.
Computes the rotation of this around the X axis and stores the result in pOut.
This computes the composition of this and the rotation of pAngle around X.
Any point P transformed by the resulting transformation will first be multiplied by this, and then the
rotation around X.
Be P' the transformed point of P, and Rx the rotation around X :
Depending on your convention : P' = Rx x this x P
or P' = P x this x Rx.
If pOut is omitted, the result is stored in this.
Optional pOut: Matrix4pOut.
Computes the rotation of this around the Y axis and stores the result in pOut.
This computes the composition of this and the rotation of pAngle around Y.
Any point P transformed by the resulting transformation will first be multiplied by this, and then the
rotation around Y.
Be P' the transformed point of P, and Ry the rotation around Y :
Depending on your convention : P' = Ry x this x P
or P' = P x this x Ry.
If pOut is omitted, the result is stored in this.
Optional pOut: Matrix4pOut.
Computes the rotation of this around the Z axis and stores the result in pOut.
This computes the composition of this and the rotation of pAngle around Z.
Any point P transformed by the resulting transformation will first be multiplied by this, and then the
rotation around Z.
Be P' the transformed point of P, and Rz the rotation around Z :
Depending on your convention : P' = Rz x this x P
or P' = P x this x Rz.
If pOut is omitted, the result is stored in this.
Optional pOut: Matrix4pOut.
Sets values for the matrix.
If you consider the matrix vector multiplication in line (V' = V x M), then the following matrix is set (translation [T0,T1,T2] on the bottom) :
| a | b | c | 0 (d) |
| e | f | g | 0 (h) |
| i | j | k | 0 (l) |
| T0 : m | T1 : n | T2 : o | 1 (p) |
| a | e | i | T0 : m |
| b | f | j | T1 : n |
| c | g | k | T2 : o |
| 0 (d) | 0 (h) | 0 (l) | 1 (p) |
Optional a: numberOptional b: numberOptional c: numberOptional d: numberOptional e: numberOptional f: numberOptional g: numberOptional h: numberOptional i: numberOptional j: numberOptional k: numberOptional l: numberOptional m: numberOptional n: numberOptional o: numberOptional p: numberthis.
Sets the matrix to be the rotation from the given quaternion values [pX,pY,pZ,pW].
The translation is reset to (0,0,0).
x component of the quaternion.y component of the quaternion.z component of the quaternion.w component of the quaternion.this.
Sets the matrix to be the rotation from the given quaternion values [pX,pY,pZ,pW].
The translation is left unchanged.
x component of the quaternion.y component of the quaternion.z component of the quaternion.w component of the quaternion.this.
Sets the matrix to be the rotation from the given values.
The translation is left unchanged.
See set to get information on the memory layout.
Returns this.
this.
Sets the matrix to be the rotation from the given matrix.
The translation is left unchanged.
this.
Copies the translation part of the matrix.
The rotation/scale part is left unchanged.
this.
Computes the transpose of the rotation part. This is useful for inverting a rotation matrix.
The translation is left unchanged (no copy of translation).
Optional pOutMatrix: Matrix4pOutMatrix.
A 4x4 Matrix.
Such a matrix contains a translation and a rotation/scale part. The matrix contains an array of 16 floats, which memory layout is the following.
If you consider the vector (V) matrix (M) multiplication in line : V' = V x M then the memory layout of the matrix is the following, with the translation part [T0,T1,T2] on the bottom :
If on the contrary you consider the vector (V) matrix (M) multiplication in column : V' = M x V then the memory layout of the matrix is the following, with the translation part [T0,T1,T2] on the right :
The multiplication in column is the convention adopted in the Matrix4 class, when a matrix M2 is multiplied on the left of M1, then any point P transformed by the resulting transformation (P') will be first transformed by M1 and then M2 :
P' = M2 x M1 x P.