Matrix

Defines a 3x2 affine 2D matrix of the following form.

| a  b  |
| c d |
| tx ty |
Summary
Defines a 3x2 affine 2D matrix of the following form.
Constructor
Applies the transformation defined by the Matrix to a point.
Applies the transformation defined by the Matrix to a point, but ignores the tx and ty properties.
Returns a list of the Matrix’s properties.
Resizes the Matrix.
Adjusts the tx and ty properties.
Sets properties so the Matrix is now an identity matrix.

Properties

a

var a: Number

b

var b: Number

c

var c: Number

d

var d: Number

tx

var tx: Number

ty

var ty: Number

Matrix

function Matrix(a : Number,
b : Number,
c : Number,
d : Number,
tx : Number,
ty : Number)

Constructor

Note

Calling new Matrix() with no parameters creates an identity matrix.

transformPoint

function transformPoint(p : Point) : Point

Applies the transformation defined by the Matrix to a point.

deltaTransformPoint

function deltaTransformPoint(p : Point) : Void

Applies the transformation defined by the Matrix to a point, but ignores the tx and ty properties.  In other words, it does not apply translation.

toString

function toString() : String

Returns a list of the Matrix’s properties.  Useful for debugging.

scale

function scale(sx : Number,
sy : Number) : Void

Resizes the Matrix.  Multiplies each x value in the Matrix (the first column) by sx.  Multiplies each y value in the Matrix (the 2nd column) by sy.

Example

var mat = new Matrix(1,1,1,1,1,1);
//mat is now (a=1, b=1, c=1, d=1, tx=1, ty=1)
mat.scale(2,3);
//mat is now (a=2, b=3, c=2, d=3, tx=2, ty=3)

translate

function translate(tx : Number,
ty : Number) : Void

Adjusts the tx and ty properties.

Example

var mat2 = new Matrix(1,1,1,1,1,1);
//mat is now (a=1, b=1, c=1, d=1, tx=1, ty=1)
mat2.translate(2,3);
//mat is now (a=1, b=1, c=1, d=1, tx=3, ty=4)

rotate

function rotate(r : Number) : Void

identity

function identity() : Void

Sets properties so the Matrix is now an identity matrix.

| 1  0  |
| 0 1 |
| 0 0 |

invert

function invert() : Void

concat

function concat(m : Matrix) : Void

clone

function clone() : Matrix

createGradientBox

function createGradientBox(width : Number,
height : Number,
rot : Number,
x : Number,
y : Number)

createBox

function createBox(scalex : Number,
scaley : Number,
rot : Number,
x : Number,
y : Number)
var a: Number
var b: Number
var c: Number
var d: Number
var tx: Number
var ty: Number
function Matrix(a : Number,
b : Number,
c : Number,
d : Number,
tx : Number,
ty : Number)
Constructor
function transformPoint(p : Point) : Point
Applies the transformation defined by the Matrix to a point.
function deltaTransformPoint(p : Point) : Void
Applies the transformation defined by the Matrix to a point, but ignores the tx and ty properties.
function toString() : String
Returns a list of the Matrix’s properties.
function scale(sx : Number,
sy : Number) : Void
Resizes the Matrix.
function translate(tx : Number,
ty : Number) : Void
Adjusts the tx and ty properties.
function rotate(r : Number) : Void
function identity() : Void
Sets properties so the Matrix is now an identity matrix.
function invert() : Void
function concat(m : Matrix) : Void
function clone() : Matrix
function createGradientBox(width : Number,
height : Number,
rot : Number,
x : Number,
y : Number)
function createBox(scalex : Number,
scaley : Number,
rot : Number,
x : Number,
y : Number)