A utility class containing methods related to the Matrix class.

### Hierarchy

- MatrixUtil

## Index

### Methods

- convertTo2D
- convertTo3D
- createOrthographicProjectionMatrix
- createPerspectiveProjectionMatrix
- isIdentity
- isIdentity3D
- prependMatrix
- prependRotation
- prependScale
- prependSkew
- prependTranslation
- skew
- snapToPixels
- toString
- toString3D
- transformCoords
- transformCoords3D
- transformPoint
- transformPoint3D

## Methods

### Static convertTo2D

- convertTo2D(matrix3D: Matrix3D, out?: Matrix): Matrix

- - Defined in lib/starling/utils/MatrixUtil.d.ts:19

  Converts 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

  - ##### Optional out: Matrix

  #### Returns Matrix

### Static convertTo3D

- convertTo3D(matrix: Matrix, out?: Matrix3D): Matrix3D

- - Defined in lib/starling/utils/MatrixUtil.d.ts:15

  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

  - ##### Optional out: Matrix3D

  #### Returns Matrix3D

### Static createOrthographicProjectionMatrix

- createOrthographicProjectionMatrix(x: number, y: number, width: number, height: number, out?: Matrix): Matrix

- - Defined in lib/starling/utils/MatrixUtil.d.ts:114

  Creates a orthographic projection matrix suitable for 2D rendering.

  #### Parameters

  - ##### x: number

  - ##### y: number

  - ##### width: number

  - ##### height: number

  - ##### Optional out: Matrix

  #### Returns Matrix

### Static createPerspectiveProjectionMatrix

- createPerspectiveProjectionMatrix(x: number, y: number, width: number, height: number, stageWidth?: number, stageHeight?: number, cameraPos?: Vector3D, out?: Matrix3D): Matrix3D

- - Defined in lib/starling/utils/MatrixUtil.d.ts:108

  Creates 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

  - ##### Optional stageWidth: number

  - ##### Optional stageHeight: number

  - ##### Optional cameraPos: Vector3D

  - ##### Optional out: Matrix3D

  #### Returns Matrix3D

### Static isIdentity

- isIdentity(matrix: Matrix): boolean

- - Defined in lib/starling/utils/MatrixUtil.d.ts:22

  Determines if the matrix is an identity matrix.

  #### Parameters

  - ##### matrix: Matrix

  #### Returns boolean

### Static isIdentity3D

- isIdentity3D(matrix: Matrix3D): boolean

- - Defined in lib/starling/utils/MatrixUtil.d.ts:25

  Determines if the 3D matrix is an identity matrix.

  #### Parameters

  - ##### matrix: Matrix3D

  #### Returns boolean

### Static prependMatrix

- prependMatrix(base: Matrix, prep: Matrix): void

- - Defined in lib/starling/utils/MatrixUtil.d.ts:58

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

  #### Parameters

  - ##### base: Matrix

  - ##### prep: Matrix

  #### Returns void

### Static prependRotation

- prependRotation(matrix: Matrix, angle: number): void

- - Defined in lib/starling/utils/MatrixUtil.d.ts:67

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

  #### Parameters

  - ##### matrix: Matrix

  - ##### angle: number

  #### Returns void

### Static prependScale

- prependScale(matrix: Matrix, sx: number, sy: number): void

- - Defined in lib/starling/utils/MatrixUtil.d.ts:64

  Prepends an incremental scale change to a Matrix object.

  #### Parameters

  - ##### matrix: Matrix

  - ##### sx: number

  - ##### sy: number

  #### Returns void

### Static prependSkew

- prependSkew(matrix: Matrix, skewX: number, skewY: number): void

- - Defined in lib/starling/utils/MatrixUtil.d.ts:77

  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

  #### Returns void

### Static prependTranslation

- prependTranslation(matrix: Matrix, tx: number, ty: number): void

- - Defined in lib/starling/utils/MatrixUtil.d.ts:61

  Prepends an incremental translation to a Matrix object.

  #### Parameters

  - ##### matrix: Matrix

  - ##### tx: number

  - ##### ty: number

  #### Returns void

### Static skew

- skew(matrix: Matrix, skewX: number, skewY: number): void

- - Defined in lib/starling/utils/MatrixUtil.d.ts:55

  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

  #### Returns void

### Static snapToPixels

- snapToPixels(matrix: Matrix, pixelSize: number): void

- - Defined in lib/starling/utils/MatrixUtil.d.ts:93

  Updates 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.

  @param matrix The matrix to manipulate in place (normally the modelview matrix). @param pixelSize The size (in points) that represents one pixel in the back buffer.

  #### Parameters

  - ##### matrix: Matrix

  - ##### pixelSize: number

  #### Returns void

### Static toString

- toString(matrix: Matrix, precision?: number): string

- - Defined in lib/starling/utils/MatrixUtil.d.ts:85

  Converts a Matrix instance to a String, which is useful when debugging.

  #### Parameters

  - ##### matrix: Matrix

  - ##### Optional precision: number

  #### Returns string

### Static toString3D

- toString3D(matrix: Matrix3D, transpose?: boolean, precision?: number): string

- - Defined in lib/starling/utils/MatrixUtil.d.ts:81

  Converts 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

  - ##### Optional transpose: boolean

  - ##### Optional precision: number

  #### Returns string

### Static transformCoords

- transformCoords(matrix: Matrix, x: number, y: number, out?: Point): Point

- - Defined in lib/starling/utils/MatrixUtil.d.ts:38

  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

  - ##### Optional out: Point

  #### Returns Point

### Static transformCoords3D

- transformCoords3D(matrix: Matrix3D, x: number, y: number, z: number, out?: Vector3D): Vector3D

- - Defined in lib/starling/utils/MatrixUtil.d.ts:44

  Uses 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

  - ##### Optional out: Vector3D

  #### Returns Vector3D

### Static transformPoint

- transformPoint(matrix: Matrix, point: Point, out?: Point): Point

- - Defined in lib/starling/utils/MatrixUtil.d.ts:28

  Transform a point with the given matrix.

  #### Parameters

  - ##### matrix: Matrix

  - ##### point: Point

  - ##### Optional out: Point

  #### Returns Point

### Static transformPoint3D

- transformPoint3D(matrix: Matrix3D, point: Vector3D, out?: Vector3D): Vector3D

- - Defined in lib/starling/utils/MatrixUtil.d.ts:32

  Transforms a 3D point with the given matrix.

  #### Parameters

  - ##### matrix: Matrix3D

  - ##### point: Vector3D

  - ##### Optional out: Vector3D

  #### Returns Vector3D

Generated using TypeDoc