Packageflare.utils
Classpublic class Matrix3DUtils
InheritanceMatrix3DUtils Inheritance Object

The Matrix3DUtils class contains help tools to work with Matrix3D-type objects.



Public Methods
 MethodDefined By
  
buildOrthoProjection(left:Number, right:Number, bottom:Number, top:Number, near:Number, far:Number, out:Matrix3D = null):Matrix3D
[static]
Matrix3DUtils
  
deltaTransformVector(m:Matrix3D, vector:Vector3D, out:Vector3D = null):Vector3D
[static] Transforms a given point multiplying it by a matrix, but without considering translation.
Matrix3DUtils
  
equal(a:Matrix3D, b:Matrix3D):Boolean
[static] Returns 'true' if 'a' and 'b' matrices are equal.
Matrix3DUtils
  
getBackward(m:Matrix3D, out:Vector3D = null):Vector3D
[static] Returns the direction vector pointing to the back side of the matrix.
Matrix3DUtils
  
getDir(m:Matrix3D, out:Vector3D = null):Vector3D
[static] Returns the dirección vector pointing to the front side of the matrix.
Matrix3DUtils
  
getDown(m:Matrix3D, out:Vector3D = null):Vector3D
[static] Returns the dirección vector pointing to the bottom side of the matrix.
Matrix3DUtils
  
getLeft(m:Matrix3D, out:Vector3D = null):Vector3D
[static] Returns the dirección vector pointing to the left side of the matrix.
Matrix3DUtils
  
getPosition(m:Matrix3D, out:Vector3D = null):Vector3D
[static] Returns a matrix position.
Matrix3DUtils
  
getQuaternion(m:Matrix3D, normalizeMatrixScale:Boolean = true, outQuat:Vector3D = null):Vector3D
[static]
Matrix3DUtils
  
getRight(m:Matrix3D, out:Vector3D = null):Vector3D
[static] Returns the direction vector pointing to the right side of the matrix.
Matrix3DUtils
  
getRotation(m:Matrix3D, out:Vector3D = null):Vector3D
[static] Returns the current rotation of the object in euler angles.
Matrix3DUtils
  
getScale(m:Matrix3D, out:Vector3D = null):Vector3D
[static] Returns a matrix scale.
Matrix3DUtils
  
getUp(m:Matrix3D, out:Vector3D = null):Vector3D
[static] Returns the direction vector pointing to the upper side of the matrix.
Matrix3DUtils
  
interpolateTo(src:Matrix3D, dest:Matrix3D, percent:Number):void
[static] Interpolates this matrix towards the translation, rotation, and scale transformations of the target matrix.
Matrix3DUtils
  
invert(m:Matrix3D, out:Matrix3D = null):Matrix3D
[static] Inverts a matrix3D.
Matrix3DUtils
  
lookAt(m:Matrix3D, x:Number, y:Number, z:Number, up:Vector3D = null, smooth:Number = 1):void
[static] Directs the object towards the specified position.
Matrix3DUtils
  
resetPosition(m:Matrix3D):void
[static] Resets the matrix position.
Matrix3DUtils
  
resetRotation(m:Matrix3D):void
[static] Resets the matrix rotation.
Matrix3DUtils
  
resetScale(m:Matrix3D):void
[static] Resets a matrix scale.
Matrix3DUtils
  
rotateAxis(m:Matrix3D, angle:Number, axis:Vector3D, pivotPoint:Vector3D = null):void
[static] Rotates the object on the specified axis from its current position.
Matrix3DUtils
  
rotateX(m:Matrix3D, angle:Number, local:Boolean = true, pivotPoint:Vector3D = null):void
[static] Rotates the matrix on the X axis from its current position.
Matrix3DUtils
  
rotateY(m:Matrix3D, angle:Number, local:Boolean = true, pivotPoint:Vector3D = null):void
[static] Rotates the matrix on the Y axis from its current position.
Matrix3DUtils
  
rotateZ(m:Matrix3D, angle:Number, local:Boolean = true, pivotPoint:Vector3D = null):void
[static] Rotates the matrix on the Z axis from its current position.
Matrix3DUtils
  
scaleX(m:Matrix3D, scale:Number):void
[static] Increases or decreases the matrix scale on the X axis.
Matrix3DUtils
  
scaleY(m:Matrix3D, scale:Number):void
[static] Increases or decreases the matrix scale on the Y axis.
Matrix3DUtils
  
scaleZ(m:Matrix3D, scale:Number):void
[static] Increases or decreases the matrix scale on the Z axis.
Matrix3DUtils
  
setNormalOrientation(m:Matrix3D, normal:Vector3D, smooth:Number = 1):void
[static] Aligns the object to a normal.
Matrix3DUtils
  
setOrientation(m:Matrix3D, dir:Vector3D, up:Vector3D = null, smooth:Number = 1):void
[static] Orients the object in a specific direction.
Matrix3DUtils
  
setPosition(m:Matrix3D, x:Number, y:Number, z:Number, smooth:Number = 1):void
[static] Returns a matrix position.
Matrix3DUtils
  
setQuaternion(m:Matrix3D, quat:Vector3D, ignoreScale:Boolean = false, ignorePosition:Boolean = false):void
[static]
Matrix3DUtils
  
setRotation(m:Matrix3D, x:Number, y:Number, z:Number):void
[static] Rotates a matrix using euler angles.
Matrix3DUtils
  
setScale(m:Matrix3D, x:Number, y:Number, z:Number, smooth:Number = 1):void
[static] Sets the object scale.
Matrix3DUtils
  
setTranslation(m:Matrix3D, x:Number = 0, y:Number = 0, z:Number = 0, local:Boolean = true):void
[static] Translates the object from its current position to the specified distance.
Matrix3DUtils
  
transformVector(m:Matrix3D, vector:Vector3D, out:Vector3D = null):Vector3D
[static] Transforms a given point multiplying it by a matrix.
Matrix3DUtils
  
translateAxis(m:Matrix3D, distance:Number, axis:Vector3D):void
[static] Translates the object on a certain axis from its current position.
Matrix3DUtils
  
translateX(m:Matrix3D, distance:Number, local:Boolean = true):void
[static] Translates the object on the X axis from its current position.
Matrix3DUtils
  
translateY(m:Matrix3D, distance:Number, local:Boolean = true):void
[static] Translates the object on the Y axis from its current position.
Matrix3DUtils
  
translateZ(m:Matrix3D, distance:Number, local:Boolean = true):void
[static] Translates the object on the Z axis from its current position.
Matrix3DUtils
Method Detail
buildOrthoProjection()method
public static function buildOrthoProjection(left:Number, right:Number, bottom:Number, top:Number, near:Number, far:Number, out:Matrix3D = null):Matrix3D

Parameters

left:Number
 
right:Number
 
bottom:Number
 
top:Number
 
near:Number
 
far:Number
 
out:Matrix3D (default = null)

Returns
Matrix3D
deltaTransformVector()method 
public static function deltaTransformVector(m:Matrix3D, vector:Vector3D, out:Vector3D = null):Vector3D

Transforms a given point multiplying it by a matrix, but without considering translation.

Parameters

m:Matrix3D — Matrix that will be used to transform the point.
 
vector:Vector3D — Vector3D that represents the point to be transformed.
 
out:Vector3D (default = null) — Vector3D where the transformed point is to be returned.

Returns
Vector3D
equal()method 
public static function equal(a:Matrix3D, b:Matrix3D):Boolean

Returns 'true' if 'a' and 'b' matrices are equal.

Parameters

a:Matrix3D — First matrix to be compared.
 
b:Matrix3D — Second matrix to be compared.

Returns
Boolean — 'true' if they are equal.
getBackward()method 
public static function getBackward(m:Matrix3D, out:Vector3D = null):Vector3D

Returns the direction vector pointing to the back side of the matrix.

Parameters

m:Matrix3D — Matrix to be tested.
 
out:Vector3D (default = null) — Output vector3D where the direction of the right vector of the matrix is to be returned.

Returns
Vector3D — If the 'out' parameter is 'null', a new Vector3D with the direccion will be returned. Otherwise, the same vector passed to the 'out' parameter will be returned.
getDir()method 
public static function getDir(m:Matrix3D, out:Vector3D = null):Vector3D

Returns the dirección vector pointing to the front side of the matrix.

Parameters

m:Matrix3D — Matrix to be tested.
 
out:Vector3D (default = null) — Output vector3D where the direction of the front vector of the matrix is to be returned.

Returns
Vector3D — If the 'out' parameter is 'null', a new Vector3D with the direction will be returned. Otherwise, the same vector passed to the 'out' parameter will be returned.
getDown()method 
public static function getDown(m:Matrix3D, out:Vector3D = null):Vector3D

Returns the dirección vector pointing to the bottom side of the matrix.

Parameters

m:Matrix3D — Matrix to be tested.
 
out:Vector3D (default = null) — Output vector3D where the direction of the front vector of the matrix is to be returned.

Returns
Vector3D — If the 'out' parameter is 'null', a new Vector3D with the direction will be returned. Otherwise, the same vector passed to the 'out' parameter will be returned.
getLeft()method 
public static function getLeft(m:Matrix3D, out:Vector3D = null):Vector3D

Returns the dirección vector pointing to the left side of the matrix.

Parameters

m:Matrix3D — Matrix to be tested.
 
out:Vector3D (default = null) — Output vector3D where the direction of the front vector of the matrix is to be returned.

Returns
Vector3D — If the 'out' parameter is 'null', a new Vector3D with the direction will be returned. Otherwise, the same vector passed to the 'out' parameter will be returned.
getPosition()method 
public static function getPosition(m:Matrix3D, out:Vector3D = null):Vector3D

Returns a matrix position.

Parameters

m:Matrix3D — Matrix to be tested.
 
out:Vector3D (default = null) — Output vector3D where the matrix position is to be returned.

Returns
Vector3D — If the 'out' is 'null', a new Vector3D with the position will be returned. Otherwise, the same vector passed to the 'out' parameter will be returned.
getQuaternion()method 
public static function getQuaternion(m:Matrix3D, normalizeMatrixScale:Boolean = true, outQuat:Vector3D = null):Vector3D

Parameters

m:Matrix3D
 
normalizeMatrixScale:Boolean (default = true)
 
outQuat:Vector3D (default = null)

Returns
Vector3D
getRight()method 
public static function getRight(m:Matrix3D, out:Vector3D = null):Vector3D

Returns the direction vector pointing to the right side of the matrix.

Parameters

m:Matrix3D — Matrix to be tested.
 
out:Vector3D (default = null) — Output vector3D where the direction of the right vector of the matrix is to be returned.

Returns
Vector3D — If the 'out' parameter is 'null', a new Vector3D with the direccion will be returned. Otherwise, the same vector passed to the 'out' parameter will be returned.
getRotation()method 
public static function getRotation(m:Matrix3D, out:Vector3D = null):Vector3D

Returns the current rotation of the object in euler angles.

Parameters

m:Matrix3D — Matrix to be tested.
 
out:Vector3D (default = null) — Output vector3D where the matrix rotation is to be returned.

Returns
Vector3D — If the 'out' parameter is 'null', a new Vector3D with the rotation will be returned. Otherwise, the same vector passed to the 'out' parameter will be returned.
getScale()method 
public static function getScale(m:Matrix3D, out:Vector3D = null):Vector3D

Returns a matrix scale.

Parameters

m:Matrix3D — Matrix to be tested.
 
out:Vector3D (default = null) — Output vector3D where the matrix scale is to be returned.

Returns
Vector3D — If the 'out' parameter is 'null', a new vector3D with the scale will be returned. Otherwise, the same vector passed to the 'out' parameter will be returned.
getUp()method 
public static function getUp(m:Matrix3D, out:Vector3D = null):Vector3D

Returns the direction vector pointing to the upper side of the matrix.

Parameters

m:Matrix3D — Matrix to be tested.
 
out:Vector3D (default = null) — Output vector3D where the direction of the upper vector of the matrix is to be returned.

Returns
Vector3D — If the 'out' parameter is 'null', a new Vector3D with the direction will be returned. Otherwise, the same vector passed to the 'out' parameter will be returned.
interpolateTo()method 
public static function interpolateTo(src:Matrix3D, dest:Matrix3D, percent:Number):void

Interpolates this matrix towards the translation, rotation, and scale transformations of the target matrix.

Parameters

src:Matrix3D — The source matrix.
 
dest:Matrix3D — The destination matrix.
 
percent:Number — The ammount of interpolation (0 to 1).

invert()method 
public static function invert(m:Matrix3D, out:Matrix3D = null):Matrix3D

Inverts a matrix3D.

Parameters

m:Matrix3D — Matrix to be inverted.
 
out:Matrix3D (default = null) — Matrix where the inverted matrix is returned.

Returns
Matrix3D — If the 'out' is 'null', a new matrix will be returned. Otherwise, the same matrix, passed to the 'out' parameter, will be returned.
lookAt()method 
public static function lookAt(m:Matrix3D, x:Number, y:Number, z:Number, up:Vector3D = null, smooth:Number = 1):void

Directs the object towards the specified position. Coordinates are related to the local space of the object.

Parameters

m:Matrix3D — Marix to be tested.
 
x:Number — Position on x
 
y:Number — Position on Y
 
z:Number — Position on z
 
up:Vector3D (default = null) — Vector3D related to the direction of the upper side of the object. The default value is (0, 1, 0).
 
smooth:Number (default = 1) — Optional interpolation value towards final transformation (0-1).

resetPosition()method 
public static function resetPosition(m:Matrix3D):void

Resets the matrix position. The position is to be set to (0,0,0).

Parameters

m:Matrix3D — Matrix whose position is to be reset.

resetRotation()method 
public static function resetRotation(m:Matrix3D):void

Resets the matrix rotation. The rotation is to be set to (0,0,0).

Parameters

m:Matrix3D — Matrix whose rotation is to be reset.

resetScale()method 
public static function resetScale(m:Matrix3D):void

Resets a matrix scale. The scale is to be set to (1,1,1).

Parameters

m:Matrix3D — Matrix whose scale is to be reset.

rotateAxis()method 
public static function rotateAxis(m:Matrix3D, angle:Number, axis:Vector3D, pivotPoint:Vector3D = null):void

Rotates the object on the specified axis from its current position. The pivotPoint parameter can be used to rotate around a point.

Parameters

m:Matrix3D — Source Matrix3D.
 
angle:Number — Angles to be rotated.
 
axis:Vector3D — Direction vector or axis on which to rotate.
 
pivotPoint:Vector3D (default = null) — Position vector that sets an anchoring point for rotation. The position must be expressed in local units.

rotateX()method 
public static function rotateX(m:Matrix3D, angle:Number, local:Boolean = true, pivotPoint:Vector3D = null):void

Rotates the matrix on the X axis from its current position. The pivotPoint parameter can be used to rotate around a point.

Parameters

m:Matrix3D — Source Matrix3D.
 
angle:Number — Angles to be rotated.
 
local:Boolean (default = true) — true to rotate respecting current orientation, or false to rotate according to orientation relative to parent.
 
pivotPoint:Vector3D (default = null) — Position vector that sets an anchoring point for rotation. The position must be expressed in local units.

rotateY()method 
public static function rotateY(m:Matrix3D, angle:Number, local:Boolean = true, pivotPoint:Vector3D = null):void

Rotates the matrix on the Y axis from its current position. The pivotPoint parameter can be used to rotate around a point.

Parameters

m:Matrix3D — Source Matrix3D.
 
angle:Number — Angles to be rotated.
 
local:Boolean (default = true) — true to rotate respecting current orientation, or false to rotate according to orientation relative to parent.
 
pivotPoint:Vector3D (default = null) — Position vector that sets an anchoring point for rotation. The position must be expressed in local units.

rotateZ()method 
public static function rotateZ(m:Matrix3D, angle:Number, local:Boolean = true, pivotPoint:Vector3D = null):void

Rotates the matrix on the Z axis from its current position. The pivotPoint parameter can be used to rotate around a point.

Parameters

m:Matrix3D — Source Matrix3D.
 
angle:Number — Angles to be rotated.
 
local:Boolean (default = true) — true to rotate respecting current orientation, or false to rotate according to orientation relative to parent.
 
pivotPoint:Vector3D (default = null) — Position vector that sets an anchoring point for rotation. The position must be expressed in local units.

scaleX()method 
public static function scaleX(m:Matrix3D, scale:Number):void

Increases or decreases the matrix scale on the X axis. Use a value greater than one to increase or less than one to decrease. Setting the scale to 2 means that objects will be scaled to twice their original size, whereas a value of 0.5 would scale objects to one half of their original size.

Parameters

m:Matrix3D — Soruce Matrix3D object.
 
scale:Number — Scale value.

scaleY()method 
public static function scaleY(m:Matrix3D, scale:Number):void

Increases or decreases the matrix scale on the Y axis. Use a value greater than one to increase or less than one to decrease. Setting the scale to 2 means that objects will be scaled to twice their original size, whereas a value of 0.5 would scale objects to one half of their original size.

Parameters

m:Matrix3D — Soruce Matrix3D object.
 
scale:Number — Scale value.

scaleZ()method 
public static function scaleZ(m:Matrix3D, scale:Number):void

Increases or decreases the matrix scale on the Z axis. Use a value greater than one to increase or less than one to decrease. Setting the scale to 2 means that objects will be scaled to twice their original size, whereas a value of 0.5 would scale objects to one half of their original size.

Parameters

m:Matrix3D — Soruce Matrix3D object.
 
scale:Number — Scale value.

setNormalOrientation()method 
public static function setNormalOrientation(m:Matrix3D, normal:Vector3D, smooth:Number = 1):void

Aligns the object to a normal.

Parameters

m:Matrix3D — Matrix to be tested.
 
normal:Vector3D — Normal used for alignment.
 
smooth:Number (default = 1) — Optional interpolation value (0-1).

setOrientation()method 
public static function setOrientation(m:Matrix3D, dir:Vector3D, up:Vector3D = null, smooth:Number = 1):void

Orients the object in a specific direction.

Parameters

m:Matrix3D — Matrix to be tested.
 
dir:Vector3D — Direction set for orientation.
 
up:Vector3D (default = null) — Upper side of the object. The default value is (0,1,0).
 
smooth:Number (default = 1) — Optional interpolation value (0-1).

setPosition()method 
public static function setPosition(m:Matrix3D, x:Number, y:Number, z:Number, smooth:Number = 1):void

Returns a matrix position.

Parameters

m:Matrix3D — Matrix to be tested.
 
x:Number — Output vector3D where the matrix position is to be returned.
 
y:Number
 
z:Number
 
smooth:Number (default = 1)

setQuaternion()method 
public static function setQuaternion(m:Matrix3D, quat:Vector3D, ignoreScale:Boolean = false, ignorePosition:Boolean = false):void

Parameters

m:Matrix3D
 
quat:Vector3D
 
ignoreScale:Boolean (default = false)
 
ignorePosition:Boolean (default = false)

setRotation()method 
public static function setRotation(m:Matrix3D, x:Number, y:Number, z:Number):void

Rotates a matrix using euler angles. Rotation is absolute; therefore, any previous rotation is to be omitted.

Parameters

m:Matrix3D — Matrix to be rotated.
 
x:Number — Rotation on X axis in angles.
 
y:Number — Rotation on Y axis in angles.
 
z:Number — Rotation on Z axis in angles.

setScale()method 
public static function setScale(m:Matrix3D, x:Number, y:Number, z:Number, smooth:Number = 1):void

Sets the object scale. This method sets the scale in an absolute manner; therefore, any previous scale will be ignored. Default value is 1, use a value greater than one to increase or less than 1 to decrease the scale. Setting the scale to 2 means that objects will be scaled to twice their original size, whereas a value of 0.5 would scale objects to one half of their original size.

Parameters

m:Matrix3D — Matrix to be tested.
 
x:Number — Scale on x
 
y:Number — Scale on y
 
z:Number — Scale on z
 
smooth:Number (default = 1)

setTranslation()method 
public static function setTranslation(m:Matrix3D, x:Number = 0, y:Number = 0, z:Number = 0, local:Boolean = true):void

Translates the object from its current position to the specified distance.

Parameters

m:Matrix3D — Matrix to be tested.
 
x:Number (default = 0) — Distance in units to translate on X axis.
 
y:Number (default = 0) — Distance in units to translate on Y axis.
 
z:Number (default = 0) — Distance in units to translate on Z axis.
 
local:Boolean (default = true) — true to translate respecting current orientation or false to translate on the coordinates relative to the parent.

See also

transformVector()method 
public static function transformVector(m:Matrix3D, vector:Vector3D, out:Vector3D = null):Vector3D

Transforms a given point multiplying it by a matrix.

Parameters

m:Matrix3D — Matrix that will be used to transform the point.
 
vector:Vector3D — Vector3D that represents the point to be transformed.
 
out:Vector3D (default = null) — out Vector3D where the transformed point is to be returned.

Returns
Vector3D
translateAxis()method 
public static function translateAxis(m:Matrix3D, distance:Number, axis:Vector3D):void

Translates the object on a certain axis from its current position.

Parameters

m:Matrix3D — Matrix to be tested.
 
distance:Number — Distance to translate.
 
axis:Vector3D — Direction vector or axis on which to translate.

See also

translateX()method 
public static function translateX(m:Matrix3D, distance:Number, local:Boolean = true):void

Translates the object on the X axis from its current position.

Parameters

m:Matrix3D — Matrix to be tested.
 
distance:Number — Distance to translate.
 
local:Boolean (default = true) — true to translate respecting current orientation, or false to translate on the coordinates relative to parent.

See also

translateY()method 
public static function translateY(m:Matrix3D, distance:Number, local:Boolean = true):void

Translates the object on the Y axis from its current position.

Parameters

m:Matrix3D — Matrix to be tested.
 
distance:Number — Distance to translate.
 
local:Boolean (default = true) — true to translate respecting current orientation, or false to translate on the coordinates relative to parent.

See also

translateZ()method 
public static function translateZ(m:Matrix3D, distance:Number, local:Boolean = true):void

Translates the object on the Z axis from its current position.

Parameters

m:Matrix3D — Matrix to be tested.
 
distance:Number — Distance to translate.
 
local:Boolean (default = true) — true to translate respecting current orientation, or false to translate on the coordinates relative to parent.

See also