Packagesandy.core.data
Classpublic final class Matrix4

A 4x4 matrix for transformations in 3D space.



Public Properties
 PropertyDefined by
  n11 : Number
Matrix4 cell.
Matrix4
  n12 : Number
Matrix4 cell.
Matrix4
  n13 : Number
Matrix4 cell.
Matrix4
  n14 : Number
Matrix4 cell.
Matrix4
  n21 : Number
Matrix4 cell.
Matrix4
  n22 : Number
Matrix4 cell.
Matrix4
  n23 : Number
Matrix4 cell.
Matrix4
  n24 : Number
Matrix4 cell.
Matrix4
  n31 : Number
Matrix4 cell.
Matrix4
  n32 : Number
Matrix4 cell.
Matrix4
  n33 : Number
Matrix4 cell.
Matrix4
  n34 : Number
Matrix4 cell.
Matrix4
  n41 : Number
Matrix4 cell.
Matrix4
  n42 : Number
Matrix4 cell.
Matrix4
  n43 : Number
Matrix4 cell.
Matrix4
  n44 : Number
Matrix4 cell.
Matrix4
  USE_FAST_MATH : Boolean = false
[static] Should we use fast math.
Matrix4
Public Methods
 MethodDefined by
  
Matrix4(pn11:Number = 1, pn12:Number = 0, pn13:Number = 0, pn14:Number = 0, pn21:Number = 0, pn22:Number = 1, pn23:Number = 0, pn24:Number = 0, pn31:Number = 0, pn32:Number = 0, pn33:Number = 1, pn34:Number = 0, pn41:Number = 0, pn42:Number = 0, pn43:Number = 0, pn44:Number = 1)
Creates a new Matrix4 matrix.
Matrix4
  
addMatrix(m2:Matrix4):void
Adds this matrix to a passed in matrix.
Matrix4
  
axisRotation(u:Number, v:Number, w:Number, angle:Number):void
Compute a Rotation around an axis{
Matrix4
  
axisRotationVector(v:Vector, angle:Number):void
Makes this matrix a rotation matrix for a rotation around a given axis.
Matrix4
  
axisRotationWithReference(axis:Vector, ref:Vector, pAngle:Number):void
Realize a rotation around a specific axis through a specified point.
Matrix4
  
Compute a clonage {
Matrix4
  
copy(m:Matrix4):void
Makes this matrix a copy of a passed in matrix.
Matrix4
  
det():Number
Returns the determinant of this 4x4 matrix.
Matrix4
  
det3x3():Number
Returns the determinant of the upper left 3x3 sub matrix of this matrix.
Matrix4
  
eulerRotation(ax:Number, ay:Number, az:Number):void
Compute a Rotation {
Matrix4
  
[static] Get the eulers angles from the rotation matrix
Matrix4
  
getTrace():Number
Returns the trace of the matrix.
Matrix4
  
Returns a vector that containes the 3D position information.
Matrix4
  
identity():void
Makes this matrix into an identity matrix.
Matrix4
  
inverse():void
Return the inverse of the matrix passed in parameter.
Matrix4
  
multiply(m2:Matrix4):void
Multiplies this matrix by a passed in matrix.
Matrix4
  
Multiplies this matrix by a passed in as if they were 3x3 matrices.
Matrix4
  
Multiplies the upper left 3x3 sub matrix of this matrix by a passed in matrix.
Matrix4
  
rotationX(angle:Number):void
Makes this matrix a rotation matrix for the given angle of rotation.
Matrix4
  
rotationY(angle:Number):void
Makes this matrix a rotation matrix for the given angle of rotation.
Matrix4
  
rotationZ(angle:Number):void
Makes this matrix a rotation matrix for the given angle of rotation.
Matrix4
  
scale(nXScale:Number, nYScale:Number, nZScale:Number):void
Makes this matrix a scale matrix from scale components.
Matrix4
  
Makes this matrix a scale matrix from a scale vector.
Matrix4
  
toString():String
Returns a string representation of this matrix.
Matrix4
  
translation(nTx:Number, nTy:Number, nTz:Number):void
Makes this matrix a translation matrix from translation components.
Matrix4
  
Makes this matrix a translation matrix from a translation vector.
Matrix4
  
vectorMult(pv:Vector):void
Multiplies a vertex with this matrix.
Matrix4
  
Multiplies a 3D vector with this matrix.
Matrix4
  
zero():void
Makes this matrix into a zero matrix.
Matrix4
Property detail
n11property
public var n11:Number

Matrix4 cell.

1 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0

n12property 
public var n12:Number

Matrix4 cell.

0 1 0 0
0 0 0 0
0 0 0 0
0 0 0 0

n13property 
public var n13:Number

Matrix4 cell.

0 0 1 0
0 0 0 0
0 0 0 0
0 0 0 0

n14property 
public var n14:Number

Matrix4 cell.

0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0

n21property 
public var n21:Number

Matrix4 cell.

0 0 0 0
1 0 0 0
0 0 0 0
0 0 0 0

n22property 
public var n22:Number

Matrix4 cell.

0 0 0 0
0 1 0 0
0 0 0 0
0 0 0 0

n23property 
public var n23:Number

Matrix4 cell.

0 0 0 0
0 0 1 0
0 0 0 0
0 0 0 0

n24property 
public var n24:Number

Matrix4 cell.

0 0 0 0
0 0 0 1
0 0 0 0
0 0 0 0

n31property 
public var n31:Number

Matrix4 cell.

0 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0

n32property 
public var n32:Number

Matrix4 cell.

0 0 0 0
0 0 0 0
0 1 0 0
0 0 0 0

n33property 
public var n33:Number

Matrix4 cell.

0 0 0 0
0 0 0 0
0 0 1 0
0 0 0 0

n34property 
public var n34:Number

Matrix4 cell.

0 0 0 0
0 0 0 0
0 0 0 1
0 0 0 0

n41property 
public var n41:Number

Matrix4 cell.

0 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0

n42property 
public var n42:Number

Matrix4 cell.

0 0 0 0
0 0 0 0
0 0 0 0
0 1 0 0

n43property 
public var n43:Number

Matrix4 cell.

0 0 0 0
0 0 0 0
0 0 0 0
0 0 1 0

n44property 
public var n44:Number

Matrix4 cell.

0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 1

USE_FAST_MATHproperty 
public static var USE_FAST_MATH:Boolean = false

Should we use fast math.

Constructor detail
Matrix4()constructor
public function Matrix4(pn11:Number = 1, pn12:Number = 0, pn13:Number = 0, pn14:Number = 0, pn21:Number = 0, pn22:Number = 1, pn23:Number = 0, pn24:Number = 0, pn31:Number = 0, pn32:Number = 0, pn33:Number = 1, pn34:Number = 0, pn41:Number = 0, pn42:Number = 0, pn43:Number = 0, pn44:Number = 1)

Creates a new Matrix4 matrix.

If 16 arguments are passed to the constructor, it will create a Matrix4 with the values. Otherwise an identity Matrix4 is created.

var m:Matrix4 = new Matrix4();
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1


var m:Matrix4 = new Matrix4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Parameters
pn11:Number (default = 1) — - pn44 Element values to populate the matrix
 
pn12:Number (default = 0)
 
pn13:Number (default = 0)
 
pn14:Number (default = 0)
 
pn21:Number (default = 0)
 
pn22:Number (default = 1)
 
pn23:Number (default = 0)
 
pn24:Number (default = 0)
 
pn31:Number (default = 0)
 
pn32:Number (default = 0)
 
pn33:Number (default = 1)
 
pn34:Number (default = 0)
 
pn41:Number (default = 0)
 
pn42:Number (default = 0)
 
pn43:Number (default = 0)
 
pn44:Number (default = 1)
Method detail
addMatrix()method
public final function addMatrix(m2:Matrix4):void

Adds this matrix to a passed in matrix.

This matrix is added to the argument matrix, element by element:
n11 = n11 + m2.n11, etc

Parameters
m2:Matrix4 — Matrix to add to thei matrix.
axisRotation()method 
public final function axisRotation(u:Number, v:Number, w:Number, angle:Number):void

Compute a Rotation around an axis{

Parameters
u:Number — {
 
v:Number — {
 
w:Number — {
 
angle:Number — angle of rotation in degree
axisRotationVector()method 
public final function axisRotationVector(v:Vector, angle:Number):void

Makes this matrix a rotation matrix for a rotation around a given axis.

The matrix is computed from the angle of rotation around the given axes of rotation.
The axis is given as a 3D vector.

Parameters
v:Vector — The axis of rotation
 
angle:Number — The angle of rotation in degrees
axisRotationWithReference()method 
public final function axisRotationWithReference(axis:Vector, ref:Vector, pAngle:Number):void

Realize a rotation around a specific axis through a specified point.

a rotation by a specified angle around a specified axis through a specific position, the reference point, is applied to this matrix.

Parameters
axis:Vector — A 3D Vector representing the axis of rtation. Must be normalized!
 
ref:Vector — The reference point.
 
pAngle:Number — The angle of rotation in degrees.
clone()method 
public final function clone():Matrix4

Compute a clonage {

Returns
Matrix4 — The result of clonage : a {
copy()method 
public final function copy(m:Matrix4):void

Makes this matrix a copy of a passed in matrix.

All elements of the argument matrix are copied into this matrix.

Parameters
m:Matrix4 — The matrix to copy.
det()method 
public final function det():Number

Returns the determinant of this 4x4 matrix.

Returns
Number — The determinant
det3x3()method 
public final function det3x3():Number

Returns the determinant of the upper left 3x3 sub matrix of this matrix.

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

Compute a Rotation {

Parameters
ax:Number — {
 
ay:Number — {
 
az:Number — {
getEulerAngles()method 
public static function getEulerAngles(t:Matrix4):Vector

Get the eulers angles from the rotation matrix

Parameters
t:Matrix4 — The Matrix4 instance from which t extract these angles

Returns
Vector — A vector that represent the Euler angles in the 3D space (X, Y and Z)
getTrace()method 
public final function getTrace():Number

Returns the trace of the matrix.

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

Returns
Number — The trace value
getTranslation()method 
public final function getTranslation():Vector

Returns a vector that containes the 3D position information.

Returns
Vector — A vector
identity()method 
public final function identity():void

Makes this matrix into an identity matrix.

A zero Matrix4 is represented like this :

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
inverse()method 
public final function inverse():void

Return the inverse of the matrix passed in parameter.

multiply()method 
public final function multiply(m2:Matrix4):void

Multiplies this matrix by a passed in matrix.

Parameters
m2:Matrix4 — The matrix to multiply with.
multiply3x3()method 
public final function multiply3x3(m2:Matrix4):void

Multiplies this matrix by a passed in as if they were 3x3 matrices.

Parameters
m2:Matrix4 — The matrix to multiply with.
multiply4x3()method 
public final function multiply4x3(m2:Matrix4):void

Multiplies the upper left 3x3 sub matrix of this matrix by a passed in matrix.

Parameters
m2:Matrix4 — The matrix to multiply with.
rotationX()method 
public final function rotationX(angle:Number):void

Makes this matrix a rotation matrix for the given angle of rotation.

Parameters
angle:Number — Number angle of rotation in degrees
rotationY()method 
public final function rotationY(angle:Number):void

Makes this matrix a rotation matrix for the given angle of rotation.

The matrix is computed from the angle of rotation around the y axes.

Parameters
angle:Number — Angle of rotation around y axis in degrees.
rotationZ()method 
public final function rotationZ(angle:Number):void

Makes this matrix a rotation matrix for the given angle of rotation.

The matrix is computed from the angle of rotation around the z axes.

Parameters
angle:Number — Angle of rotation around z axis in degrees.
scale()method 
public final function scale(nXScale:Number, nYScale:Number, nZScale:Number):void

Makes this matrix a scale matrix from scale components.

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

Parameters
nXScale:Number — x-scale.
 
nYScale:Number — y-scale.
 
nZScale:Number — z-scale.
scaleVector()method 
public final function scaleVector(v:Vector):void

Makes this matrix a scale 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 scale vector.
toString()method 
public final function toString():String

Returns a string representation of this matrix.

Returns
String — The string representing this matrix
translation()method 
public final function translation(nTx:Number, nTy:Number, nTz:Number):void

Makes this matrix a translation matrix from translation components.

   |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.
translationVector()method 
public final function translationVector(v:Vector):void

Makes this matrix a translation matrix from a translation vector.

   |1  0  0  0|
   |0  1  0  0|
   |0  0  1  0|
   |v.x v.y v.z 1|
   

Parameters
v:Vector — The translation Vector.
vectorMult()method 
public final function vectorMult(pv:Vector):void

Multiplies a vertex with this matrix.

Parameters
pv:Vector — The vertex to be mutliplied
vectorMult3x3()method 
public final function vectorMult3x3(pv:Vector):void

Multiplies a 3D vector with this matrix.

The vector is multiplied with te upper left 3x3 sub matrix

Parameters
pv:Vector — The vector to be mutliplied
zero()method 
public final function zero():void

Makes this matrix into a zero matrix.

A zero Matrix4 is represented like this :

0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0