Packagesandy.math
Classpublic class Matrix4Math

Math functions for Matrix4 calculations.



Public Properties
 PropertyDefined by
  USE_FAST_MATH : Boolean = false
[static] Should we use the fast math calculations?

Set to true if fast math is used - Default false

Matrix4Math
Public Methods
 MethodDefined by
  
[static] Computes the addition of two Matrix4 matrices.
Matrix4Math
  
axisRotation(u:Number, v:Number, w:Number, angle:Number):Matrix4
[static] Computes a rotation Matrix4 matrix for a general axis of rotation.
Matrix4Math
  
axisRotationVector(v:Vector, angle:Number):Matrix4
[static] Computes a rotation Matrix4 matrix for a general axis of rotation.
Matrix4Math
  
axisRotationWithReference(axis:Vector, ref:Vector, pAngle:Number):Matrix4
[static] Computes a Matrix4 matrix for a rotation around a specific axis through a specific point.
Matrix4Math
  
[static] Returns the clone of a Matrix4 matrix.
Matrix4Math
  
det(m:Matrix4):Number
[static] Computes the determinant of a Matrix4 matrix.
Matrix4Math
  
det3x3(m:Matrix4):Number
[static] Computes the 3x3 determinant of a Matrix4 matrix.
Matrix4Math
  
eulerRotation(ax:Number, ay:Number, az:Number):Matrix4
[static] Computes a rotation Matrix4 matrix from the Euler angle in degrees.
Matrix4Math
  
[static] Returns the inverse of a Matrix4 matrix.
Matrix4Math
  
getTrace(m:Matrix4):Number
[static] Computes the trace of a Matrix4 matrix.
Matrix4Math
  
[static] Computes the multiplication of two Matrix4 matrices.
Matrix4Math
  
[static] Computes the multiplication of two Matrix4 matrices, as if they were 3x3.
Matrix4Math
  
[static] Computes the multiplication of two Matrix4 matrices.
Matrix4Math
  
rotationX(angle:Number):Matrix4
[static] Computes a rotation Matrix4 matrix for an x axis rotation.
Matrix4Math
  
rotationY(angle:Number):Matrix4
[static] Computes a rotation Matrix4 matrix for an y axis rotation.
Matrix4Math
  
rotationZ(angle:Number):Matrix4
[static] Computes a rotation Matrix4 matrix for an z axis rotation.
Matrix4Math
  
scale(nXScale:Number, nYScale:Number, nZScale:Number):Matrix4
[static] Computes a scale Matrix4 matrix.
Matrix4Math
  
[static] Computes a scale Matrix4 matrix from a scale vector.
Matrix4Math
  
translation(nTx:Number, nTy:Number, nTz:Number):Matrix4
[static] Computes a translation Matrix4 matrix.
Matrix4Math
  
[static] Computes a translation Matrix4 matrix from a vector.
Matrix4Math
  
[static] Multiplies a 3D vertex by a Matrix4 matrix.
Matrix4Math
  
[static] Multiplies a 3D vector by a Matrix4 matrix as a 3x3 matrix.
Matrix4Math
Property detail
USE_FAST_MATHproperty
public static var USE_FAST_MATH:Boolean = false

Should we use the fast math calculations?

Set to true if fast math is used - Default false

Method detail
addMatrix4()method
public static function addMatrix4(m1:Matrix4, m2:Matrix4):Matrix4

Computes the addition of two Matrix4 matrices.

Parameters
m1:Matrix4 — The first matrix.
 
m2:Matrix4 — The second matrix.

Returns
Matrix4 — The resulting matrix
axisRotation()method 
public static function axisRotation(u:Number, v:Number, w:Number, angle:Number):Matrix4

Computes a rotation Matrix4 matrix for a general axis of rotation.

[ToDo: My gosh! Explain this Thomas ;-) ]

Parameters
u:Number — rotation X.
 
v:Number — rotation Y.
 
w:Number — rotation Z.
 
angle:Number — The angle of rotation in degrees

Returns
Matrix4 — The resulting Matrix4 matrix.
axisRotationVector()method 
public static function axisRotationVector(v:Vector, angle:Number):Matrix4

Computes a rotation Matrix4 matrix for a general axis of rotation.

Parameters
v:Vector — The axis of rotation
 
angle:Number — The angle of rotation in degrees

Returns
Matrix4 — The resulting Matrix4 matrix.
axisRotationWithReference()method 
public static function axisRotationWithReference(axis:Vector, ref:Vector, pAngle:Number):Matrix4

Computes a Matrix4 matrix for a rotation around a specific axis through a specific point.

NOTE - The axis must be normalized!

Parameters
axis:Vector — A vector representing the axis of rtation.
 
ref:Vector — The center of rotation.
 
pAngle:Number — The angle of rotation in degrees.

Returns
Matrix4
clone()method 
public static function clone(m:Matrix4):Matrix4

Returns the clone of a Matrix4 matrix.

Parameters
m:Matrix4 — The matrix to clone

Returns
Matrix4 — The resulting matrix
det()method 
public static function det(m:Matrix4):Number

Computes the determinant of a Matrix4 matrix.

Parameters
m:Matrix4 — The matrix

Returns
Number — The determinant
det3x3()method 
public static function det3x3(m:Matrix4):Number

Computes the 3x3 determinant of a Matrix4 matrix.

Uses the upper left 3 by 3 elements

Parameters
m:Matrix4 — The matrix

Returns
Number — The determinant
eulerRotation()method 
public static function eulerRotation(ax:Number, ay:Number, az:Number):Matrix4

Computes a rotation Matrix4 matrix from the Euler angle in degrees.

Parameters
ax:Number — Angle of rotation around X axis in degrees.
 
ay:Number — Angle of rotation around Y axis in degrees.
 
az:Number — Angle of rotation around Z axis in degrees.

Returns
Matrix4 — The resulting Matrix4 matrix.
getInverse()method 
public static function getInverse(m:Matrix4):Matrix4

Returns the inverse of a Matrix4 matrix.

Parameters
m:Matrix4 — The matrix to invert

Returns
Matrix4 — The inverse Matrix4 matrix
getTrace()method 
public static function getTrace(m:Matrix4):Number

Computes the trace of a Matrix4 matrix.

The trace value is the sum of the element on the diagonal of the matrix

Parameters
m:Matrix4 — The matrix we want to compute the trace

Returns
Number — The trace value
multiply()method 
public static function multiply(m1:Matrix4, m2:Matrix4):Matrix4

Computes the multiplication of two Matrix4 matrices.

[ToDo: Explain this multiplication ]

Parameters
m1:Matrix4 — The first matrix.
 
m2:Matrix4 — The second matrix.

Returns
Matrix4 — The resulting matrix
multiply3x3()method 
public static function multiply3x3(m1:Matrix4, m2:Matrix4):Matrix4

Computes the multiplication of two Matrix4 matrices, as if they were 3x3.

Parameters
m1:Matrix4 — The first matrix.
 
m2:Matrix4 — The second matrix.

Returns
Matrix4 — The resulting matrix

See also

sandy.core.data.Matrix4"
multiply4x3()method 
public static function multiply4x3(m1:Matrix4, m2:Matrix4):Matrix4

Computes the multiplication of two Matrix4 matrices.

[ToDo: Explain this multiplication ]

Parameters
m1:Matrix4 — The first matrix.
 
m2:Matrix4 — The second matrix.

Returns
Matrix4 — The resulting matrix
rotationX()method 
public static function rotationX(angle:Number):Matrix4

Computes a rotation Matrix4 matrix for an x axis rotation.

Parameters
angle:Number — Angle of rotation

Returns
Matrix4 — The resulting Matrix4 matrix.
rotationY()method 
public static function rotationY(angle:Number):Matrix4

Computes a rotation Matrix4 matrix for an y axis rotation.

Parameters
angle:Number — Angle of rotation

Returns
Matrix4 — The resulting Matrix4 matrix.
rotationZ()method 
public static function rotationZ(angle:Number):Matrix4

Computes a rotation Matrix4 matrix for an z axis rotation.

Parameters
angle:Number — Angle of rotation

Returns
Matrix4 — The resulting Matrix4 matrix.
scale()method 
public static function scale(nXScale:Number, nYScale:Number, nZScale:Number):Matrix4

Computes a scale Matrix4 matrix.

   |Sx 0  0  0|
   |0  Sy 0  0|
   |0  0  Sz 0|
   |0  0  0  1|
   

Parameters
nXScale:Number — Scale factor in the x direction
 
nYScale:Number — Scale factor in the y direction
 
nZScale:Number — Scale factor in the z direction

Returns
Matrix4 — The resulting Matrix4 matrix.
scaleVector()method 
public static function scaleVector(v:Vector):Matrix4

Computes a scale Matrix4 matrix from a scale vector.

   |Sx 0  0  0|
   |0  Sy 0  0|
   |0  0  Sz 0|
   |0  0  0  1|
   

Parameters
v:Vector — The vector containing the scale values

Returns
Matrix4 — The resulting Matrix4 matrix.
translation()method 
public static function translation(nTx:Number, nTy:Number, nTz:Number):Matrix4

Computes a translation Matrix4 matrix.

   |1  0  0  0|
   |0  1  0  0|
   |0  0  1  0|
   |Tx Ty Tz 1|
   

Parameters
nTx:Number — Translation in the x direction.
 
nTy:Number — Translation in the y direction.
 
nTz:Number — Translation in the z direction.

Returns
Matrix4 — The resulting Matrix4 matrix.
translationVector()method 
public static function translationVector(v:Vector):Matrix4

Computes a translation Matrix4 matrix from a vector.

   |1  0  0  0|
   |0  1  0  0|
   |0  0  1  0|
   |Tx Ty Tz 1|
   

Parameters
v:Vector — Translation Vector.

Returns
Matrix4 — The resulting Matrix4 matrix.
vectorMult()method 
public static function vectorMult(m:Matrix4, pv:Vector):Vector

Multiplies a 3D vertex by a Matrix4 matrix.

Parameters
m:Matrix4 — The matrix.
 
pv:Vector — The vertex

Returns
Vector — The resulting vector
vectorMult3x3()method 
public static function vectorMult3x3(m:Matrix4, pv:Vector):Vector

Multiplies a 3D vector by a Matrix4 matrix as a 3x3 matrix.

Uses the upper left 3 by 3 elements

Parameters
m:Matrix4 — The matrix
 
pv:Vector — The vector

Returns
Vector — The resulting vector