Class Matrix4
Represents a four by four matrix.
Defined in: benchgl.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Matrix4(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)
Creates a new Matrix4.
|
Method Attributes | Method Name and Description |
---|---|
$add(m)
Adds this Matrix4 to another one.
|
|
Sets this Matrix4 to the identity matrix.
|
|
$invert()
Inverts this Matrix4.
|
|
Multiplies this Matrix4 by another one.
|
|
$sub(m)
Subtracts this Matrix4 to another one.
|
|
Transpose this Matrix4.
|
|
add(m)
Adds this Matrix4 to another one.
|
|
copy()
Copies this Matrix4 in another one.
|
|
<static> |
Matrix4.Frustum(left, right, bottom, top, near, far)
Creates a frustum matrix.
|
<static> |
Matrix4.Identity()
Creates the identity matrix.
|
invert()
Inverts this Matrix4.
|
|
<static> |
Matrix4.LookAt(eye, direction, up)
Creates a lookAt matrix.
|
multiplyMat4(m)
Multiplies this Matrix4 by another one.
|
|
multiplyVec3(vector)
Multiplies a Vector3 by this Matrix4.
|
|
<static> |
Matrix4.Perspective(fovy, aspect, near, far)
Creates a perspective matrix.
|
<static> |
Matrix4.Rotate(angle, x, y, z)
Creates a general rotation matrix around an axis.
|
<static> |
Matrix4.RotateXYZ(rx, ry, rz)
Creates a rotation matrix around an x, y and z axis.
|
<static> |
Matrix4.Scale(x, y, z)
Creates a scale matrix.
|
set(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)
Sets the elements of this Matrix4.
|
|
sub(m)
Subtracts this Matrix4 to another one.
|
|
Gets a Float32Array representation of this Matrix4.
|
|
<static> |
Matrix4.Translate(x, y, z)
Creates a translation matrix.
|
Transpose this Matrix4.
|
Class Detail
Matrix4(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)
Creates a new Matrix4. If no argumnets are supplied returns the identity matrix.
- Parameters:
- {Number} m11 Optional, Default: 1
- The element at row 1 column 1.
- {Number} m12 Optional, Default: 0
- The element at row 1 column 2.
- {Number} m13 Optional, Default: 0
- The element at row 1 column 3.
- {Number} m14 Optional, Default: 0
- The element at row 1 column 4.
- {Number} m21 Optional, Default: 0
- The element at row 2 column 1.
- {Number} m22 Optional, Default: 1
- The element at row 2 column 2.
- {Number} m23 Optional, Default: 0
- The element at row 2 column 3.
- {Number} m24 Optional, Default: 0
- The element at row 2 column 4.
- {Number} m31 Optional, Default: 0
- The element at row 3 column 1.
- {Number} m32 Optional, Default: 0
- The element at row 3 column 2.
- {Number} m33 Optional, Default: 1
- The element at row 3 column 3.
- {Number} m34 Optional, Default: 0
- The element at row 3 column 4.
- {Number} m41 Optional, Default: 0
- The element at row 4 column 1.
- {Number} m42 Optional, Default: 0
- The element at row 4 column 2.
- {Number} m43 Optional, Default: 0
- The element at row 4 column 3.
- {Number} m44 Optional, Default: 1
- The element at row 4 column 4.
Method Detail
{Matrix4}
$add(m)
Adds this Matrix4 to another one. Affects this Matrix4.
- Parameters:
- {Matrix4} m
- The Matrix4 to add.
- Returns:
- {Matrix4} This Matrix4 now contains the addition.
{Matrix4}
$identity()
Sets this Matrix4 to the identity matrix. Affects this Matrix4.
- Returns:
- {Matrix4} This Matrix4 is now an identity matrix.
{Matrix4}
$invert()
Inverts this Matrix4. Affects this Matrix4.
- Returns:
- {Matrix4} This Matrix4 is now inverted.
{Matrix4}
$multiplyMat4(m)
Multiplies this Matrix4 by another one. Affects this Matrix4.
- Parameters:
- m
- Returns:
- {Matrix4} This Matrix4 now stores the result of the multiplication.
{Matrix4}
$sub(m)
Subtracts this Matrix4 to another one. Affects this Matrix4.
- Parameters:
- {Matrix4} m
- The Matrix4 to add.
- Returns:
- {Matrix4} This Matrix4 now contains the subtraction.
{Matrix4}
$transpose()
Transpose this Matrix4. Affects this Matrix4.
- Returns:
- {Matrix4} This Matrix4 is now transposed.
{Matrix4}
add(m)
Adds this Matrix4 to another one. Does not affect this Matrix4.
- Parameters:
- {Matrix4} m
- The Matrix4 to add.
- Returns:
- {Matrix4} A new matrix containing the addition.
{Matrix4}
copy()
Copies this Matrix4 in another one.
- Returns:
- {Matrix4} A copy of this Matrix4.
<static>
{Matrix4}
Matrix4.Frustum(left, right, bottom, top, near, far)
Creates a frustum matrix.
- Parameters:
- {Number} left
- The left clipping plane.
- {Number} right
- The right clipping plane.
- {Number} bottom
- The bottom clipping plane.
- {Number} top
- The top clipping plane.
- {Number} near
- The near clipping plane.
- {Number} far
- The far clipping plane.
- Returns:
- {Matrix4} A frustum matrix.
<static>
{Matrix4}
Matrix4.Identity()
Creates the identity matrix.
- Returns:
- {Matrix4} The identity matrix.
{Matrix4}
invert()
Inverts this Matrix4. Does not affect this Matrix4.
- Returns:
- {Matrix4} A new matrix representing the inverted of this MAtrix4.
<static>
{Matrix4}
Matrix4.LookAt(eye, direction, up)
Creates a lookAt matrix.
- Parameters:
- {Vector3} eye
- The eye vector.
- {Vector3} direction
- The direction vector.
- {Vector3} up
- The up vector.
- Returns:
- {Matrix4} A lookAt Matrix4.
{Matrix4}
multiplyMat4(m)
Multiplies this Matrix4 by another one. Does not affect this Matrix4.
- Parameters:
- m
- Returns:
- {Matrix4} A new matrix with the result of the multiplication.
{Vector3}
multiplyVec3(vector)
Multiplies a Vector3 by this Matrix4. (r = M*v)
- Parameters:
- vector
- Returns:
- {Vector3} A new vector with the result of the multiplication.
<static>
{Matrix4}
Matrix4.Perspective(fovy, aspect, near, far)
Creates a perspective matrix.
- Parameters:
- {Number} fovy
- The vertical field of view angle.
- {Number} aspect
- The aspect ratio aka the horizontal field of view angle.
- {Number} near
- The near clipping plane.
- {Number} far
- The far clipping plane.
- Returns:
- {Matrix4} A perspective matrix.
<static>
{Matrix4}
Matrix4.Rotate(angle, x, y, z)
Creates a general rotation matrix around an axis.
- Parameters:
- {Number} angle
- The rotation angle in radians.
- {Number} x
- The axis x coordinate.
- {Number} y
- The axis y coordinate.
- {Number} z
- The axis z coordinate.
- Returns:
- {Matrix4} A general rotation matrix.
<static>
{Matrix4}
Matrix4.RotateXYZ(rx, ry, rz)
Creates a rotation matrix around an x, y and z axis.
- Parameters:
- {Number} rx
- The rotation angle around x axis.
- {Number} ry
- The rotation angle around y axis.
- {Number} rz
- The rotation angle around z axis.
- Returns:
- {Matrix4} A XYZ rotation matrix.
<static>
{Matrix4}
Matrix4.Scale(x, y, z)
Creates a scale matrix.
- Parameters:
- {Number} x
- The scale on x coordinate.
- {Number} y
- The scale on y coordinate.
- {Number} z
- The scale on z coordinate.
- Returns:
- {Matrix4} A scale matrix.
set(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)
Sets the elements of this Matrix4.
- Parameters:
- {Number} m11
- The element at row 1 column 1.
- {Number} m12
- The element at row 1 column 2.
- {Number} m13
- The element at row 1 column 3.
- {Number} m14
- The element at row 1 column 4.
- {Number} m21
- The element at row 2 column 1.
- {Number} m22
- The element at row 2 column 2.
- {Number} m23
- The element at row 2 column 3.
- {Number} m24
- The element at row 2 column 4.
- {Number} m31
- The element at row 3 column 1.
- {Number} m32
- The element at row 3 column 2.
- {Number} m33
- The element at row 3 column 3.
- {Number} m34
- The element at row 3 column 4.
- {Number} m41
- The element at row 4 column 1.
- {Number} m42
- The element at row 4 column 2.
- {Number} m43
- The element at row 4 column 3.
- {Number} m44
- The element at row 4 column 4.
{Matrix4}
sub(m)
Subtracts this Matrix4 to another one. Does not affect this Matrix4.
- Parameters:
- {Matrix4} m
- The Matrix4 to add.
- Returns:
- {Matrix4} A new matrix containing the subtraction.
{Float32Array}
toFloat32Array()
Gets a Float32Array representation of this Matrix4.
- Returns:
- {Float32Array} A new Float32Array containing the elements of this Matrix.
<static>
{Matrix4}
Matrix4.Translate(x, y, z)
Creates a translation matrix.
- Parameters:
- {Number} x
- The translation on x coordinate.
- {Number} y
- The translation on y coordinate.
- {Number} z
- The translation on z coordinate.
- Returns:
- {Matrix4} A translation matrix.
{Matrix4}
transpose()
Transpose this Matrix4. Does not affect this Matrix4.
- Returns:
- {Matrix4} A new matrix representing the transpose of this Matrix4.