| Package | starling.utils |
| Class | public class MatrixUtil |
| Inheritance | MatrixUtil Object |
| Method | Defined By | ||
|---|---|---|---|
convertTo2D(matrix3D:Matrix3D, out:Matrix = null):Matrix [static] Converts a 3D matrix to a 2D matrix. | MatrixUtil | ||
convertTo3D(matrix:Matrix, out:Matrix3D = null):Matrix3D [static] Converts a 2D matrix to a 3D matrix. | MatrixUtil | ||
createOrthographicProjectionMatrix(x:Number, y:Number, width:Number, height:Number, out:Matrix = null):Matrix [static] Creates a orthographic projection matrix suitable for 2D rendering. | MatrixUtil | ||
createPerspectiveProjectionMatrix(x:Number, y:Number, width:Number, height:Number, stageWidth:Number = 0, stageHeight:Number = 0, cameraPos:Vector3D = null, out:Matrix3D = null):Matrix3D [static] Creates a perspective projection matrix suitable for 2D and 3D rendering. | MatrixUtil | ||
isIdentity(matrix:Matrix):Boolean [static] Determines if the matrix is an identity matrix. | MatrixUtil | ||
isIdentity3D(matrix:Matrix3D):Boolean [static] Determines if the 3D matrix is an identity 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 | ||
snapToPixels(matrix:Matrix, pixelSize:Number):void [static] Updates the given matrix so that it points exactly to pixel boundaries. | MatrixUtil | ||
toString(matrix:Matrix, precision:int = 3):String [static] Converts a Matrix instance to a String, which is useful when debugging. | MatrixUtil | ||
toString3D(matrix:Matrix3D, transpose:Boolean = true, precision:int = 3):String [static] Converts a Matrix3D instance to a String, which is useful when debugging. | MatrixUtil | ||
transformCoords(matrix:Matrix, x:Number, y:Number, out:Point = null):Point [static] Uses a matrix to transform 2D coordinates into a different space. | MatrixUtil | ||
transformCoords3D(matrix:Matrix3D, x:Number, y:Number, z:Number, out:Vector3D = null):Vector3D [static] Uses a matrix to transform 3D coordinates into a different space. | MatrixUtil | ||
transformPoint(matrix:Matrix, point:Point, out:Point = null):Point [static] Transform a point with the given matrix. | MatrixUtil | ||
transformPoint3D(matrix:Matrix3D, point:Vector3D, out:Vector3D = null):Vector3D [static] Transforms a 3D point with the given matrix. | MatrixUtil | ||
| convertTo2D | () | method |
public static function convertTo2D(matrix3D:Matrix3D, out:Matrix = null):MatrixConverts a 3D matrix to a 2D matrix. Beware that this will work only for a 3D matrix describing a pure 2D transformation.
Parameters
matrix3D:Matrix3D | |
out:Matrix (default = null) |
Matrix |
| convertTo3D | () | method |
public static function convertTo3D(matrix:Matrix, out:Matrix3D = null):Matrix3D Converts a 2D matrix to a 3D matrix. If you pass an out-matrix,
the result will be stored in this matrix instead of creating a new object.
Parameters
matrix:Matrix | |
out:Matrix3D (default = null) |
Matrix3D |
| createOrthographicProjectionMatrix | () | method |
public static function createOrthographicProjectionMatrix(x:Number, y:Number, width:Number, height:Number, out:Matrix = null):MatrixCreates a orthographic projection matrix suitable for 2D rendering.
Parameters
x:Number | |
y:Number | |
width:Number | |
height:Number | |
out:Matrix (default = null) |
Matrix |
| createPerspectiveProjectionMatrix | () | method |
public static function createPerspectiveProjectionMatrix(x:Number, y:Number, width:Number, height:Number, stageWidth:Number = 0, stageHeight:Number = 0, cameraPos:Vector3D = null, out:Matrix3D = null):Matrix3DCreates a perspective projection matrix suitable for 2D and 3D rendering.
The first 4 parameters define which area of the stage you want to view (the camera will 'zoom' to exactly this region). The final 3 parameters determine the perspective in which you're looking at the stage.
The stage is always on the rectangle that is spawned up between x- and y-axis (with the given size). All objects that are exactly on that rectangle (z equals zero) will be rendered in their true size, without any distortion.
If you pass only the first 4 parameters, the camera will be set up above the center of the stage, with a field of view of 1.0 rad.
Parameters
x:Number | |
y:Number | |
width:Number | |
height:Number | |
stageWidth:Number (default = 0) | |
stageHeight:Number (default = 0) | |
cameraPos:Vector3D (default = null) | |
out:Matrix3D (default = null) |
Matrix3D |
| isIdentity | () | method |
public static function isIdentity(matrix:Matrix):BooleanDetermines if the matrix is an identity matrix.
Parameters
matrix:Matrix |
Boolean |
| isIdentity3D | () | method |
public static function isIdentity3D(matrix:Matrix3D):BooleanDetermines if the 3D matrix is an identity matrix.
Parameters
matrix:Matrix3D |
Boolean |
| prependMatrix | () | method |
public static function prependMatrix(base:Matrix, prep:Matrix):voidPrepends 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):voidPrepends 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):voidPrepends 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):voidPrepends 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):voidPrepends 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):voidAppends 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 |
| snapToPixels | () | method |
public static function snapToPixels(matrix:Matrix, pixelSize:Number):voidUpdates the given matrix so that it points exactly to pixel boundaries. This works only if the object is unscaled and rotated by a multiple of 90 degrees.
Parameters
matrix:Matrix — The matrix to manipulate in place (normally the modelview matrix).
| |
pixelSize:Number — The size (in points) that represents one pixel in the back buffer.
|
| toString | () | method |
public static function toString(matrix:Matrix, precision:int = 3):StringConverts a Matrix instance to a String, which is useful when debugging.
Parameters
matrix:Matrix | |
precision:int (default = 3) |
String |
| toString3D | () | method |
public static function toString3D(matrix:Matrix3D, transpose:Boolean = true, precision:int = 3):StringConverts a Matrix3D instance to a String, which is useful when debugging. Per default, the raw data is displayed transposed, so that the columns are displayed vertically.
Parameters
matrix:Matrix3D | |
transpose:Boolean (default = true) | |
precision:int (default = 3) |
String |
| transformCoords | () | method |
public static function transformCoords(matrix:Matrix, x:Number, y:Number, out:Point = null):Point Uses a matrix to transform 2D coordinates into a different space. If you pass an
out-point, the result will be stored in this point instead of creating
a new object.
Parameters
matrix:Matrix | |
x:Number | |
y:Number | |
out:Point (default = null) |
Point |
| transformCoords3D | () | method |
public static function transformCoords3D(matrix:Matrix3D, x:Number, y:Number, z:Number, out:Vector3D = null):Vector3DUses a matrix to transform 3D coordinates into a different space. If you pass a 'resultVector', the result will be stored in this vector3D instead of creating a new object.
Parameters
matrix:Matrix3D | |
x:Number | |
y:Number | |
z:Number | |
out:Vector3D (default = null) |
Vector3D |
| transformPoint | () | method |
public static function transformPoint(matrix:Matrix, point:Point, out:Point = null):PointTransform a point with the given matrix.
Parameters
matrix:Matrix | |
point:Point | |
out:Point (default = null) |
Point |
| transformPoint3D | () | method |
public static function transformPoint3D(matrix:Matrix3D, point:Vector3D, out:Vector3D = null):Vector3DTransforms a 3D point with the given matrix.
Parameters
matrix:Matrix3D | |
point:Vector3D | |
out:Vector3D (default = null) |
Vector3D |