GODPAPER | All Packages | All Classes | Index | Frames No Frames |
MatrixUtil

Package | starling.utils
Class | public class MatrixUtil
Inheritance | MatrixUtil Object

A utility class containing methods related to the Matrix class.

Public Methods

| Method | Defined By
--- | --- | ---
|  | convertTo3D(matrix:Matrix, resultMatrix:Matrix3D = null):Matrix3D [static] Converts a 2D matrix to a 3D matrix. | MatrixUtil
|  | prependMatrix(base:Matrix, prep:Matrix):void [static] Prepends a matrix to 'base' by multiplying it with another matrix. | MatrixUtil
|  | prependRotation(matrix:Matrix, angle:Number):void [static] Prepends an incremental rotation to a Matrix object (angle in radians). | MatrixUtil
|  | prependScale(matrix:Matrix, sx:Number, sy:Number):void [static] Prepends an incremental scale change to a Matrix object. | MatrixUtil
|  | prependSkew(matrix:Matrix, skewX:Number, skewY:Number):void [static] Prepends a skew transformation to a Matrix object (angles in radians). | MatrixUtil
|  | prependTranslation(matrix:Matrix, tx:Number, ty:Number):void [static] Prepends an incremental translation to a Matrix object. | MatrixUtil
|  | skew(matrix:Matrix, skewX:Number, skewY:Number):void [static] Appends a skew transformation to a matrix (angles in radians). | MatrixUtil
|  | transformCoords(matrix:Matrix, x:Number, y:Number, resultPoint:Point = null):Point [static] Uses a matrix to transform 2D coordinates into a different space. | MatrixUtil

Method Detail

convertTo3D | () | method

`public static function convertTo3D(matrix:Matrix, resultMatrix:Matrix3D = null):Matrix3D`

Converts a 2D matrix to a 3D matrix. If you pass a 'resultMatrix', the result will be stored in this matrix instead of creating a new object.

Parameters

| `matrix:Matrix`
| `resultMatrix:Matrix3D` (default = `null`)``

Returns

| `Matrix3D`

prependMatrix | () | method |

`public static function prependMatrix(base:Matrix, prep:Matrix):void`

Prepends a matrix to 'base' by multiplying it with another matrix.

Parameters

| `base:Matrix`
| `prep:Matrix`

prependRotation | () | method |

`public static function prependRotation(matrix:Matrix, angle:Number):void`

Prepends an incremental rotation to a Matrix object (angle in radians).

Parameters

| `matrix:Matrix`
| `angle:Number`

prependScale | () | method |

`public static function prependScale(matrix:Matrix, sx:Number, sy:Number):void`

Prepends an incremental scale change to a Matrix object.

Parameters

| `matrix:Matrix`
| `sx:Number`
| `sy:Number`

prependSkew | () | method |

`public static function prependSkew(matrix:Matrix, skewX:Number, skewY:Number):void`

Prepends a skew transformation to a Matrix object (angles in radians). The skew matrix has the following form:

              | cos(skewY)  -sin(skewX)  0 |
              | sin(skewY)   cos(skewX)  0 |
              |     0            0       1 |

Parameters

| `matrix:Matrix`
| `skewX:Number`
| `skewY:Number`

prependTranslation | () | method |

`public static function prependTranslation(matrix:Matrix, tx:Number, ty:Number):void`

Prepends an incremental translation to a Matrix object.

Parameters

| `matrix:Matrix`
| `tx:Number`
| `ty:Number`

skew | () | method |

`public static function skew(matrix:Matrix, skewX:Number, skewY:Number):void`

Appends a skew transformation to a matrix (angles in radians). The skew matrix has the following form:

              | cos(skewY)  -sin(skewX)  0 |
              | sin(skewY)   cos(skewX)  0 |
              |     0            0       1 |

Parameters

| `matrix:Matrix`
| `skewX:Number`
| `skewY:Number`

transformCoords | () | method |

`public static function transformCoords(matrix:Matrix, x:Number, y:Number, resultPoint:Point = null):Point`

Uses a matrix to transform 2D coordinates into a different space. If you pass a 'resultPoint', the result will be stored in this point instead of creating a new object.

Parameters

| `matrix:Matrix`
| `x:Number`
| `y:Number`
| `resultPoint:Point` (default = `null`)``

Returns

| `Point`

Thu Jan 16 2014, 01:11 PM +08:00