Matrix4
A 4x4 matrix.
Constructor Summary
Public Constructor | ||
public |
Constructs a new matrix. |
Member Summary
Public Members | ||
public |
The matrix elements. |
Method Summary
Public Methods | ||
public |
Clones this matrix. |
|
public |
compose(position: Vector3, quaternion: Quaternion, scale: Vector3): Matrix4 Sets this matrix based on the given position, rotation and scale. |
|
public |
Copies the values of a given matrix. |
|
public |
copyPosition(matrix: Matrix4): Matrix4 Copies the position values of a given matrix. |
|
public |
decompose(position: Vector3, quaternion: Quaternion, scale: Vector3): Matrix4 Decomposes this matrix into a position, rotation and scale vector. |
|
public |
Calculates the determinant of this matrix. |
|
public |
Checks if this matrix equals the given one. |
|
public |
extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4 Extracts the basis from this matrix. |
|
public |
Extracts the rotation from a given matrix. |
|
public |
Copies the values of a given array. |
|
public |
getInverse(matrix: Matrix4): Matrix4 Inverts the given matrix and stores the result in this matrix. |
|
public |
Returns the largest scale. |
|
public |
Sets this matrix to the identity matrix. |
|
public |
Creates a rotation that looks at the given target. |
|
public |
Sets the basis of this matrix. |
|
public |
makeOrthographic(left: Number, right: Number, top: Number, bottom: Number, near: Number, far: Number): Matrix4 Creates an orthographic matrix. |
|
public |
makePerspective(left: Number, right: Number, top: Number, bottom: Number, near: Number, far: Number): Matrix4 Creates a perspective matrix. |
|
public |
makeRotationAxis(axis: Vector3, angle: Number): Matrix4 Makes this matrix a translation matrix with respect to a specific axis. |
|
public |
makeRotationFromEuler(euler: Euler): Matrix4 Sets the matrix rotation based on the given Euler angles. |
|
public |
Sets the matrix rotation based on the given quaternion. |
|
public |
makeRotationX(theta: Number): Matrix4 Makes this matrix a rotation matrix. |
|
public |
makeRotationY(theta: Number): Matrix4 Makes this matrix a rotation matrix with respect to the Y-axis. |
|
public |
makeRotationZ(theta: Number): Matrix4 Makes this matrix a rotation matrix with respect to the Z-axis. |
|
public |
Makes this matrix a scale matrix. |
|
public |
Makes this matrix a shear matrix. |
|
public |
makeTranslation(x: Number, y: Number, z: Number): Matrix4 Makes this matrix a translation matrix. |
|
public |
Multiplies this matrix with the given one. |
|
public |
multiplyMatrices(a: Matrix4, b: Matrix4): Matrix4 Sets this matrix to the product of the given matrices. |
|
public |
multiplyScalar(s: Number): Matrix4 Multiplies this matrix with a given scalar. |
|
public |
premultiply(m: Matrix4): Matrix4 Multiplies a given matrix with this one. |
|
public |
Scales this matrix. |
|
public |
set(n00: Number, n01: Number, n02: Number, n03: Number, n10: Number, n11: Number, n12: Number, n13: Number, n20: Number, n21: Number, n22: Number, n23: Number, n30: Number, n31: Number, n32: Number, n33: Number): Matrix4 Sets the values of this matrix. |
|
public |
setPosition(p: Vector3): Matrix4 Sets the position values of this matrix. |
|
public |
Stores this matrix in an array. |
|
public |
Transposes this matrix. |
Public Constructors
Public Members
Public Methods
public compose(position: Vector3, quaternion: Quaternion, scale: Vector3): Matrix4 source
Sets this matrix based on the given position, rotation and scale.
Params:
Name | Type | Attribute | Description |
position | Vector3 | The position. |
|
quaternion | Quaternion | The rotation. |
|
scale | Vector3 | The scale. |
public copy(matrix: Matrix4): Matrix4 source
Copies the values of a given matrix.
Params:
Name | Type | Attribute | Description |
matrix | Matrix4 | A matrix. |
public copyPosition(matrix: Matrix4): Matrix4 source
Copies the position values of a given matrix.
Params:
Name | Type | Attribute | Description |
matrix | Matrix4 | A matrix. |
public decompose(position: Vector3, quaternion: Quaternion, scale: Vector3): Matrix4 source
Decomposes this matrix into a position, rotation and scale vector.
Params:
Name | Type | Attribute | Description |
position | Vector3 | The target position. |
|
quaternion | Quaternion | The target rotation. |
|
scale | Vector3 | The target scale. |
public determinant(): Number source
Calculates the determinant of this matrix.
For more details see: http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
public equals(m: Matrix4): Boolean source
Checks if this matrix equals the given one.
Params:
Name | Type | Attribute | Description |
m | Matrix4 | A matrix. |
public extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4 source
Extracts the basis from this matrix.
public extractRotation(m: Matrix4): Matrix4 source
Extracts the rotation from a given matrix.
This method does not support reflection matrices.
Params:
Name | Type | Attribute | Description |
m | Matrix4 | A matrix. |
public fromArray(array: Number[], offset: Number): Matrix4 source
Copies the values of a given array.
public getInverse(matrix: Matrix4): Matrix4 source
Inverts the given matrix and stores the result in this matrix.
For details see: http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
Params:
Name | Type | Attribute | Description |
matrix | Matrix4 | The matrix that should be inverted. |
public lookAt(eye: Vector3, target: Vector3, up: Vector3): Matrix4 source
Creates a rotation that looks at the given target.
public makeBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4 source
Sets the basis of this matrix.
public makeOrthographic(left: Number, right: Number, top: Number, bottom: Number, near: Number, far: Number): Matrix4 source
Creates an orthographic matrix.
Params:
Name | Type | Attribute | Description |
left | Number | The distance to the left plane. |
|
right | Number | The distance to the right plane. |
|
top | Number | The distance to the top plane. |
|
bottom | Number | The distance to the bottom plane. |
|
near | Number | The distance to the near plane. |
|
far | Number | The distance to the far plane. |
public makePerspective(left: Number, right: Number, top: Number, bottom: Number, near: Number, far: Number): Matrix4 source
Creates a perspective matrix.
Params:
Name | Type | Attribute | Description |
left | Number | The distance to the left plane. |
|
right | Number | The distance to the right plane. |
|
top | Number | The distance to the top plane. |
|
bottom | Number | The distance to the bottom plane. |
|
near | Number | The distance to the near plane. |
|
far | Number | The distance to the far plane. |
public makeRotationAxis(axis: Vector3, angle: Number): Matrix4 source
Makes this matrix a translation matrix with respect to a specific axis.
For mor einformation see: http://www.gamedev.net/reference/articles/article1199.asp
public makeRotationFromEuler(euler: Euler): Matrix4 source
Sets the matrix rotation based on the given Euler angles.
Params:
Name | Type | Attribute | Description |
euler | Euler | The euler angles. |
public makeRotationFromQuaternion(q: Quaternion): Matrix4 source
Sets the matrix rotation based on the given quaternion.
Params:
Name | Type | Attribute | Description |
q | Quaternion | The quaternion. |
public makeRotationX(theta: Number): Matrix4 source
Makes this matrix a rotation matrix.
Params:
Name | Type | Attribute | Description |
theta | Number | The angle in radians. |
public makeRotationY(theta: Number): Matrix4 source
Makes this matrix a rotation matrix with respect to the Y-axis.
Params:
Name | Type | Attribute | Description |
theta | Number | The angle in radians. |
public makeRotationZ(theta: Number): Matrix4 source
Makes this matrix a rotation matrix with respect to the Z-axis.
Params:
Name | Type | Attribute | Description |
theta | Number | The angle in radians. |
public makeTranslation(x: Number, y: Number, z: Number): Matrix4 source
Makes this matrix a translation matrix.
public multiply(m: Matrix4): Matrix4 source
Multiplies this matrix with the given one.
Params:
Name | Type | Attribute | Description |
m | Matrix4 | A matrix. |
public multiplyMatrices(a: Matrix4, b: Matrix4): Matrix4 source
Sets this matrix to the product of the given matrices.
public multiplyScalar(s: Number): Matrix4 source
Multiplies this matrix with a given scalar.
Params:
Name | Type | Attribute | Description |
s | Number | A scalar. |
public premultiply(m: Matrix4): Matrix4 source
Multiplies a given matrix with this one.
Params:
Name | Type | Attribute | Description |
m | Matrix4 | A matrix. |
public set(n00: Number, n01: Number, n02: Number, n03: Number, n10: Number, n11: Number, n12: Number, n13: Number, n20: Number, n21: Number, n22: Number, n23: Number, n30: Number, n31: Number, n32: Number, n33: Number): Matrix4 source
Sets the values of this matrix.
Params:
Name | Type | Attribute | Description |
n00 | Number | The value of the first row, first column. |
|
n01 | Number | The value of the first row, second column. |
|
n02 | Number | The value of the first row, third column. |
|
n03 | Number | The value of the first row, fourth column. |
|
n10 | Number | The value of the second row, first column. |
|
n11 | Number | The value of the second row, second column. |
|
n12 | Number | The value of the second row, third column. |
|
n13 | Number | The value of the second row, fourth column. |
|
n20 | Number | The value of the third row, first column. |
|
n21 | Number | The value of the third row, second column. |
|
n22 | Number | The value of the third row, third column. |
|
n23 | Number | The value of the third row, fourth column. |
|
n30 | Number | The value of the fourth row, first column. |
|
n31 | Number | The value of the fourth row, second column. |
|
n32 | Number | The value of the fourth row, third column. |
|
n33 | Number | The value of the fourth row, fourth column. |
public setPosition(p: Vector3): Matrix4 source
Sets the position values of this matrix.
Params:
Name | Type | Attribute | Description |
p | Vector3 | A position. |