Packageorg.flintparticles.threeD.geom
Classpublic class Matrix3D

Matrix3D represents a 3D transformation matrix. It mimics some aspects of the flash.geom.Matrix3D class embedded in the Flash Player version 10.



Public Properties
 PropertyDefined by
  determinant : Number
[read-only] The determinant of the matrix
Matrix3D
  inverse : Matrix3D
[read-only] The inverse of this matrix, or null if no inverse exists
Matrix3D
  n11 : Number
The value in row 1 column 1 of the matrix.
Matrix3D
  n12 : Number
The value in row 1 column 2 of the matrix.
Matrix3D
  n13 : Number
The value in row 1 column 3 of the matrix.
Matrix3D
  n14 : Number
The value in row 1 column 4 of the matrix.
Matrix3D
  n21 : Number
The value in row 2 column 1 of the matrix.
Matrix3D
  n22 : Number
The value in row 2 column 2 of the matrix.
Matrix3D
  n23 : Number
The value in row 2 column 3 of the matrix.
Matrix3D
  n24 : Number
The value in row 2 column 4 of the matrix.
Matrix3D
  n31 : Number
The value in row 3 column 1 of the matrix.
Matrix3D
  n32 : Number
The value in row 3 column 2 of the matrix.
Matrix3D
  n33 : Number
The value in row 3 column 3 of the matrix.
Matrix3D
  n34 : Number
The value in row 3 column 4 of the matrix.
Matrix3D
  n41 : Number
The value in row 4 column 1 of the matrix.
Matrix3D
  n42 : Number
The value in row 4 column 2 of the matrix.
Matrix3D
  n43 : Number
The value in row 4 column 3 of the matrix.
Matrix3D
  n44 : Number
The value in row 4 column 4 of the matrix.
Matrix3D
  position : Point3D
The positionelements of the matrix.
Matrix3D
  rawData : Array
An array containing the sixteen values in the matrix, in row-major form.
Matrix3D
Public Methods
 MethodDefined by
  
Matrix3D(values:Array = null)
Creates a Matrix3D object from an array of numbers.
Matrix3D
  
Add another transformation matrix to this one, applying the new transformation after the transformations already in this matrix.
Matrix3D
  
Append a coordinate system transformation such that the vectors indicated are transformed to the x, y and z axes.
Matrix3D
  
appendRotate(angle:Number, axis:Vector3D, pivotPoint:Point3D = null):Matrix3D
Append a rotation about an axis transformation to this matrix, applying the rotation after the transformations already in this matrix.
Matrix3D
  
appendScale(scaleX:Number, scaleY:Number, scaleZ:Number):Matrix3D
Append a scale transformation to this matrix, applying the scale after the transformations already in this matrix.
Matrix3D
  
appendTranslate(x:Number, y:Number, z:Number):Matrix3D
Append a translation transformation to this matrix, applying the translation after the transformations already in this matrix.
Matrix3D
  
Make a duplicate of this matrix
Matrix3D
  
Copy another matrix into this one
Matrix3D
  
equals(m:Matrix3D):Boolean
Compare another matrix with this one
Matrix3D
  
Invert this matrix.
Matrix3D
  
nearEquals(m:Matrix3D, e:Number):Boolean
Compare another matrix with this one
Matrix3D
  
[static] Creates a coordinate system transformation such that the vectors indicated are transformed to the x, y and z axes.
Matrix3D
  
newRotate(angle:Number, axis:Vector3D, pivotPoint:Point3D = null):Matrix3D
[static] Creates a new Matrix3D for rotation about an axis.
Matrix3D
  
newScale(scaleX:Number, scaleY:Number, scaleZ:Number):Matrix3D
[static] Creates a new Matrix3D for scaling.
Matrix3D
  
newTranslate(x:Number, y:Number, z:Number):Matrix3D
[static] Creates a new Matrix3D for translation.
Matrix3D
  
Add another transformation matrix to this one, applying the new transformation before the transformations already in this matrix.
Matrix3D
  
Prepend a coordinate system transformation such that the vectors indicated are transformed to the x, y and z axes.
Matrix3D
  
prependRotate(angle:Number, axis:Vector3D, pivotPoint:Point3D = null):Matrix3D
Prepend a rotation about an axis transformation to this matrix, applying the rotation before the transformations already in this matrix.
Matrix3D
  
prependScale(scaleX:Number, scaleY:Number, scaleZ:Number):Matrix3D
Prepend a scale transformation to this matrix, applying the scale before the transformations already in this matrix.
Matrix3D
  
prependTranslate(x:Number, y:Number, z:Number):Matrix3D
Prepend a translation transformation to this matrix, applying the translation before the transformations already in this matrix.
Matrix3D
  
toString():String
Matrix3D
  
transform(v:Transformable3D, result:Transformable3D = null):Transformable3D
Transform a Vector3D or Point3D using this matrix, returning a new, transformed vector.
Matrix3D
  
transformArray(vectors:Array):Array
Transform an array of Vector3D or Point3D objects using this matrix.
Matrix3D
  
transformArraySelf(vectors:Array):Array
Transform an array of Vector3D or Point3D objects using this matrix.
Matrix3D
  
transformSelf(v:Transformable3D):Transformable3D
Transform a Vector3D or Point3D using this matrix, storing the result in the original vector.
Matrix3D
Public Constants
 ConstantDefined by
  IDENTITY : Matrix3D
[static] An identity matrix.
Matrix3D
  ZERO : Matrix3D
[static] A zero matrix.
Matrix3D
Property detail
determinantproperty
determinant:Number  [read-only]

The determinant of the matrix

Implementation
    public function get determinant():Number
inverseproperty 
inverse:Matrix3D  [read-only]

The inverse of this matrix, or null if no inverse exists

Implementation
    public function get inverse():Matrix3D
n11property 
public var n11:Number

The value in row 1 column 1 of the matrix. x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

n12property 
public var n12:Number

The value in row 1 column 2 of the matrix. 0 x 0 0 0 0 0 0 0 0 0 0 0 0 0 0

n13property 
public var n13:Number

The value in row 1 column 3 of the matrix. 0 0 x 0 0 0 0 0 0 0 0 0 0 0 0 0

n14property 
public var n14:Number

The value in row 1 column 4 of the matrix. 0 0 0 x 0 0 0 0 0 0 0 0 0 0 0 0

n21property 
public var n21:Number

The value in row 2 column 1 of the matrix. 0 0 0 0 x 0 0 0 0 0 0 0 0 0 0 0

n22property 
public var n22:Number

The value in row 2 column 2 of the matrix. 0 0 0 0 0 x 0 0 0 0 0 0 0 0 0 0

n23property 
public var n23:Number

The value in row 2 column 3 of the matrix. 0 0 0 0 0 0 x 0 0 0 0 0 0 0 0 0

n24property 
public var n24:Number

The value in row 2 column 4 of the matrix. 0 0 0 0 0 0 0 x 0 0 0 0 0 0 0 0

n31property 
public var n31:Number

The value in row 3 column 1 of the matrix. 0 0 0 0 0 0 0 0 x 0 0 0 0 0 0 0

n32property 
public var n32:Number

The value in row 3 column 2 of the matrix. 0 0 0 0 0 0 0 0 0 x 0 0 0 0 0 0

n33property 
public var n33:Number

The value in row 3 column 3 of the matrix. 0 0 0 0 0 0 0 0 0 0 x 0 0 0 0 0

n34property 
public var n34:Number

The value in row 3 column 4 of the matrix. 0 0 0 0 0 0 0 0 0 0 0 x 0 0 0 0

n41property 
public var n41:Number

The value in row 4 column 1 of the matrix. 0 0 0 0 0 0 0 0 0 0 0 0 x 0 0 0

n42property 
public var n42:Number

The value in row 4 column 2 of the matrix. 0 0 0 0 0 0 0 0 0 0 0 0 0 x 0 0

n43property 
public var n43:Number

The value in row 4 column 3 of the matrix. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x 0

n44property 
public var n44:Number

The value in row 4 column 4 of the matrix. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 x

positionproperty 
position:Point3D  [read-write]

The positionelements of the matrix. This is the last column of the matrix, containing values n14, n24, n34, n44.

Implementation
    public function get position():Point3D
    public function set position(value:Point3D):void
rawDataproperty 
rawData:Array  [read-write]

An array containing the sixteen values in the matrix, in row-major form.

[n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44]

Implementation
    public function get rawData():Array
    public function set rawData(value:Array):void
Constructor detail
Matrix3D()constructor
public function Matrix3D(values:Array = null)

Creates a Matrix3D object from an array of numbers.

The array may contain 12 or 16 numbers in row major form. If the array contains only 12 values, the values 0,0,0,1 are used to populate the last row of the matrix. If no array is passed in, an identity matrix is created.

Parameters
values:Array (default = null) — The raw data to populate the matrix with.
Method detail
append()method
public function append(m:Matrix3D):Matrix3D

Add another transformation matrix to this one, applying the new transformation after the transformations already in this matrix.

Parameters
m:Matrix3D — The other transformation matrix

Returns
Matrix3D — A reference to this matrix
appendBasisTransform()method 
public function appendBasisTransform(axisX:Vector3D, axisY:Vector3D, axisZ:Vector3D):Matrix3D

Append a coordinate system transformation such that the vectors indicated are transformed to the x, y and z axes. The vectors need not be perpendicular, but they must form a basis for 3D space.

Parameters
axisX:Vector3D — The vector that is translated to ( 1, 0, 0 ) by the transform.
 
axisY:Vector3D — The vector that is translated to ( 0, 1, 0 ) by the transform.
 
axisZ:Vector3D — The vector that is translated to ( 0, 0, 1 ) by the transform.

Returns
Matrix3D — A reference to this matrix
appendRotate()method 
public function appendRotate(angle:Number, axis:Vector3D, pivotPoint:Point3D = null):Matrix3D

Append a rotation about an axis transformation to this matrix, applying the rotation after the transformations already in this matrix.

Parameters
angle:Number — The rotation angle in radians. If this is not set, the w coordinate of the axis is used as the angle.
 
axis:Vector3D — The vector to rotate around
 
pivotPoint:Point3D (default = null) — The point the axis passes through. The default value is the origin.

Returns
Matrix3D — A reference to this matrix
appendScale()method 
public function appendScale(scaleX:Number, scaleY:Number, scaleZ:Number):Matrix3D

Append a scale transformation to this matrix, applying the scale after the transformations already in this matrix.

Parameters
scaleX:Number — The scaling factor in the x direction
 
scaleY:Number — The scaling factor in the y direction
 
scaleZ:Number — The scaling factor in the z direction

Returns
Matrix3D — A reference to this matrix
appendTranslate()method 
public function appendTranslate(x:Number, y:Number, z:Number):Matrix3D

Append a translation transformation to this matrix, applying the translation after the transformations already in this matrix.

Parameters
x:Number — The translation along the x axis.
 
y:Number — The translation along the y axis.
 
z:Number — The translation along the z axis.

Returns
Matrix3D — A reference to this matrix
clone()method 
public function clone():Matrix3D

Make a duplicate of this matrix

Returns
Matrix3D — The new matrix
copy()method 
public function copy(m:Matrix3D):Matrix3D

Copy another matrix into this one

Parameters
m:Matrix3D — the matrix to copy

Returns
Matrix3D — a reference to this matrix
equals()method 
public function equals(m:Matrix3D):Boolean

Compare another matrix with this one

Parameters
m:Matrix3D — the matrix to compare with

Returns
Boolean — true if the matrices are the same, false otherwise
invert()method 
public function invert():Matrix3D

Invert this matrix. If no inverse exists, the matrix is invalid and null is returned.

Returns
Matrix3D — A reference to this matrix or null if no inverse exists
nearEquals()method 
public function nearEquals(m:Matrix3D, e:Number):Boolean

Compare another matrix with this one

Parameters
m:Matrix3D — the matrix to compare with
 
e:Number — The small variation allowed between the values representing the matrices

Returns
Boolean — true if the matrices are the within e of each other, false otherwise
newBasisTransform()method 
public static function newBasisTransform(axisX:Vector3D, axisY:Vector3D, axisZ:Vector3D):Matrix3D

Creates a coordinate system transformation such that the vectors indicated are transformed to the x, y and z axes. The vectors need not be perpendicular, but they must form a basis for 3D space.

Parameters
axisX:Vector3D — The vector that is translated to ( 1, 0, 0 ) by the transform.
 
axisY:Vector3D — The vector that is translated to ( 0, 1, 0 ) by the transform.
 
axisZ:Vector3D — The vector that is translated to ( 0, 0, 1 ) by the transform.

Returns
Matrix3D
newRotate()method 
public static function newRotate(angle:Number, axis:Vector3D, pivotPoint:Point3D = null):Matrix3D

Creates a new Matrix3D for rotation about an axis.

Parameters
angle:Number — The angle in radians for the rotation
 
axis:Vector3D — The axis to rotate around
 
pivotPoint:Point3D (default = null) — The point the axis passes through. The default value is the origin.

Returns
Matrix3D — The new matrix
newScale()method 
public static function newScale(scaleX:Number, scaleY:Number, scaleZ:Number):Matrix3D

Creates a new Matrix3D for scaling.

Parameters
scaleX:Number — The scale factor in the x direction
 
scaleY:Number — The scale factor in the y direction
 
scaleZ:Number — The scale factor in the z direction

Returns
Matrix3D — The new matrix
newTranslate()method 
public static function newTranslate(x:Number, y:Number, z:Number):Matrix3D

Creates a new Matrix3D for translation.

Parameters
x:Number — The translation along the x axis.
 
y:Number — The translation along the y axis.
 
z:Number — The translation along the z axis.

Returns
Matrix3D — The new matrix
prepend()method 
public function prepend(m:Matrix3D):Matrix3D

Add another transformation matrix to this one, applying the new transformation before the transformations already in this matrix.

Parameters
m:Matrix3D — The other transformation matrix

Returns
Matrix3D — A reference to this matrix
prependBasisTransform()method 
public function prependBasisTransform(axisX:Vector3D, axisY:Vector3D, axisZ:Vector3D):Matrix3D

Prepend a coordinate system transformation such that the vectors indicated are transformed to the x, y and z axes. The vectors need not be perpendicular, but they must form a basis for 3D space.

Parameters
axisX:Vector3D — The vector that is translated to ( 1, 0, 0 ) by the transform.
 
axisY:Vector3D — The vector that is translated to ( 0, 1, 0 ) by the transform.
 
axisZ:Vector3D — The vector that is translated to ( 0, 0, 1 ) by the transform.

Returns
Matrix3D — A reference to this matrix
prependRotate()method 
public function prependRotate(angle:Number, axis:Vector3D, pivotPoint:Point3D = null):Matrix3D

Prepend a rotation about an axis transformation to this matrix, applying the rotation before the transformations already in this matrix.

Parameters
angle:Number — The rotation angle in radians. If this is not set, the w coordinate of the axis is used as the angle.
 
axis:Vector3D — The vector to rotate around
 
pivotPoint:Point3D (default = null) — The point the axis passes through. The default value is the origin.

Returns
Matrix3D — A reference to this matrix
prependScale()method 
public function prependScale(scaleX:Number, scaleY:Number, scaleZ:Number):Matrix3D

Prepend a scale transformation to this matrix, applying the scale before the transformations already in this matrix.

Parameters
scaleX:Number — The scaling factor in the x direction
 
scaleY:Number — The scaling factor in the y direction
 
scaleZ:Number — The scaling factor in the z direction

Returns
Matrix3D — A reference to this matrix
prependTranslate()method 
public function prependTranslate(x:Number, y:Number, z:Number):Matrix3D

Prepend a translation transformation to this matrix, applying the translation before the transformations already in this matrix.

Parameters
x:Number — The translation along the x axis.
 
y:Number — The translation along the y axis.
 
z:Number — The translation along the z axis.

Returns
Matrix3D — A reference to this matrix
toString()method 
public function toString():String

Returns
String
transform()method 
public function transform(v:Transformable3D, result:Transformable3D = null):Transformable3D

Transform a Vector3D or Point3D using this matrix, returning a new, transformed vector.

Parameters
v:Transformable3D — The vector to transform.
 
result:Transformable3D (default = null)

Returns
Transformable3D — The result of the transformation.
transformArray()method 
public function transformArray(vectors:Array):Array

Transform an array of Vector3D or Point3D objects using this matrix. The results are returned in a new array.

Parameters
vectors:Array — the array of Vector3D or Point3D objects to transform.

Returns
Array — An array containing the new transformed vectors.
transformArraySelf()method 
public function transformArraySelf(vectors:Array):Array

Transform an array of Vector3D or Point3D objects using this matrix. The original vectors are modified to contain the new, transformed values.

Parameters
vectors:Array — the array of Vector3D or Point3D objects to transform.

Returns
Array — The original array, which now contains the transformed vectors.
transformSelf()method 
public function transformSelf(v:Transformable3D):Transformable3D

Transform a Vector3D or Point3D using this matrix, storing the result in the original vector.

Parameters
v:Transformable3D — The vector to transform.

Returns
Transformable3D — A reference to the original (now transformed) vector.
Constant detail
IDENTITYconstant
public static const IDENTITY:Matrix3D

An identity matrix.

ZEROconstant 
public static const ZERO:Matrix3D

A zero matrix.