Documentation

Classes

Class CL3D.Matrix4

A 4x4 matrix, mostly used as transformation matrix for 3d calculations.

Class Overview
CL3D.Matrix4(bMakeIdentity)
A 4x4 matrix. Mostly used as transformation matrix for 3d calculations. The matrix is a D3D style matrix, row major with translations in the 4th row.
Parameters:
{Boolean} bMakeIdentity
If set to true, the matrix will initially have stored the identity matrix.

Method Summary
Method Attributes Method Name and Description
 
Returns the content of this matrix as array
 
buildCameraLookAtMatrixLH(position, target, upVector)
Builds a left-handed look-at matrix.
 
buildProjectionMatrixPerspectiveFovLH(fieldOfViewRadians, aspectRatio, zNear, zFar)
Builds a left-handed perspective projection matrix based on a field of view.
 
buildProjectionMatrixPerspectiveOrthoLH(widthOfViewVolume, heightOfViewVolume, zNear, zFar)
Builds a left-handed orthogonal projection matrix.
 
buildProjectionMatrixPerspectiveOrthoRH(widthOfViewVolume, heightOfViewVolume, zNear, zFar)
Builds a left-handed orthogonal projection matrix.
 
Creates a clone of this matrix
 
copyTo(mat)
Copies the content of this matrix to a target matrix
 
equals(mat)
Returns if this matrix equals another matrix, uses CL3D.equals as comparison operator.
 
Copies the inverse of this matrix into the output matrix, returns true succcessful.
 
Returns a new vector, rotated from the input vector by this matrix
 
Returns the rotation, as set by setRotation().
 
Returns the scle stored in the matrix as 3d vector
 
returns a new transformed vector from the input vector
 
Translates a input vector by this matrix and returns it as new vector.
 
Returns the translation stored in the matrix as 3d vector
 
Returns a transposed version of this matrix
 
Rotate a vector by the inverse of the rotation part of this matrix.
 
Returns if this matrix is the identity matrix
 
returns if only the translation is set in the matrix
 
Makes this matrix the identitiy matrix
 
Inverts this matrix, returns true if successful
 
Multiplies this matrix with another matrix, returns the result as a new matrix.
 
Multiplies this matrix with a 4D Vector (expects components X, Y, Z and W), result is stored in the input vector
 
same as multiplyWith1x4Matrix, but faster and returns w as value
 
Rotates a 3d vector by this matrix.
 
rotateVect2(out, inp)
Rotates an input vector and stores the result in the output paramter
 
setByIndex(i, n)
Sets a value of the matrix by index
 
Make a rotation matrix from Euler angles.
 
Make a rotation matrix from Euler angles.
 
Sets the scale of the matrix
 
setScaleXYZ(x, y, z)
Sets the scale of the matrix
 
Set the translation of the current matrix.
 
Returns a string representation of this matrix.
 
Transforms a 3d box
 
Transforms a 3d box with another method which is more exact than transformBoxEx
 
Transforms a 3d plane by this matrix
 
Transforms the input vector by this matrix
 
transformVect2(out, inp)
Transforms the input vector by this matrix and stores the result in the ouput parameter
 
Translates a vector by this matrix
Method Detail
{Array} asArray()
Returns the content of this matrix as array
Returns:
{Array} array of this matrix.

buildCameraLookAtMatrixLH(position, target, upVector)
Builds a left-handed look-at matrix.
Parameters:
position
target
upVector

buildProjectionMatrixPerspectiveFovLH(fieldOfViewRadians, aspectRatio, zNear, zFar)
Builds a left-handed perspective projection matrix based on a field of view.
Parameters:
fieldOfViewRadians
aspectRatio
zNear
zFar

buildProjectionMatrixPerspectiveOrthoLH(widthOfViewVolume, heightOfViewVolume, zNear, zFar)
Builds a left-handed orthogonal projection matrix.
Parameters:
widthOfViewVolume
heightOfViewVolume
zNear
zFar

buildProjectionMatrixPerspectiveOrthoRH(widthOfViewVolume, heightOfViewVolume, zNear, zFar)
Builds a left-handed orthogonal projection matrix.
Parameters:
widthOfViewVolume
heightOfViewVolume
zNear
zFar

clone()
Creates a clone of this matrix

copyTo(mat)
Copies the content of this matrix to a target matrix
Parameters:
mat

equals(mat)
Returns if this matrix equals another matrix, uses CL3D.equals as comparison operator.
Parameters:
mat

getInverse(out)
Copies the inverse of this matrix into the output matrix, returns true succcessful.
Parameters:
out

getRotatedVect(v)
Returns a new vector, rotated from the input vector by this matrix
Parameters:
v

{CL3D.Vect3d} getRotationDegrees()
Returns the rotation, as set by setRotation(). Returns a rotation that is equivalent to that set by setRotationDegrees().
Returns:
{CL3D.Vect3d} rotation vector

{CL3D.Vect3d} getScale()
Returns the scle stored in the matrix as 3d vector
Returns:
{CL3D.Vect3d} scale vector

getTransformedVect(v)
returns a new transformed vector from the input vector
Parameters:
v

getTranslatedVect(v)
Translates a input vector by this matrix and returns it as new vector.
Parameters:
v

{CL3D.Vect3d} getTranslation()
Returns the translation stored in the matrix as 3d vector
Returns:
{CL3D.Vect3d} translation vector

getTransposed()
Returns a transposed version of this matrix

inverseRotateVect(v)
Rotate a vector by the inverse of the rotation part of this matrix.
Parameters:
v

isIdentity()
Returns if this matrix is the identity matrix

isTranslateOnly()
returns if only the translation is set in the matrix

makeIdentity()
Makes this matrix the identitiy matrix

makeInverse()
Inverts this matrix, returns true if successful

multiply(m2)
Multiplies this matrix with another matrix, returns the result as a new matrix.
Parameters:
m2

multiplyWith1x4Matrix(v)
Multiplies this matrix with a 4D Vector (expects components X, Y, Z and W), result is stored in the input vector
Parameters:
v

multiplyWith1x4Matrix2(v)
same as multiplyWith1x4Matrix, but faster and returns w as value
Parameters:
v

rotateVect(v)
Rotates a 3d vector by this matrix.
Parameters:
v

rotateVect2(out, inp)
Rotates an input vector and stores the result in the output paramter
Parameters:
out
inp

setByIndex(i, n)
Sets a value of the matrix by index
Parameters:
i
Index in the matrix, a value between 0 and 15
n
Value to set

setRotationDegrees(v)
Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
Parameters:
{CL3D.Vect3d} v
rotation vector

setRotationRadians(rotation)
Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
Parameters:
{CL3D.Vect3d} rotation
rotation vector

setScale(v)
Sets the scale of the matrix
Parameters:
{CL3D.Vect3d} v
translation vector

setScaleXYZ(x, y, z)
Sets the scale of the matrix
Parameters:
x
y
z

setTranslation(v)
Set the translation of the current matrix. Will erase any previous values.
Parameters:
{CL3D.Vect3d} v
translation vector

toString()
Returns a string representation of this matrix.

transformBoxEx(box)
Transforms a 3d box
Parameters:
{CL3D.Box3d} box

transformBoxEx2(box)
Transforms a 3d box with another method which is more exact than transformBoxEx
Parameters:
{CL3D.Box3d} box

transformPlane(plane)
Transforms a 3d plane by this matrix
Parameters:
plane

transformVect(v)
Transforms the input vector by this matrix
Parameters:
v

transformVect2(out, inp)
Transforms the input vector by this matrix and stores the result in the ouput parameter
Parameters:
out
inp

translateVect(v)
Translates a vector by this matrix
Parameters:
v

© 2011-2018 N.Gebhardt, Ambiera
Documentation generated by JsDoc Toolkit