Class Matrix
Defined in: matrix.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Matrix(a, b, c, d, tx, ty)
_ _ | a c tx | | b d ty | |_0 0 1 _|Creates a matrix for 2d affine transformations. |
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
Matrix.HORIZONTAL_FLIP
A constant representing the horizontal flip transformation matrix.
|
| <static> |
Matrix.IDENTITY
A constant representing the identity matrix.
|
| <static> |
Matrix.VERTICAL_FLIP
A constant representing the vertical flip transformation matrix.
|
| Method Attributes | Method Name and Description |
|---|---|
|
concat(matrix)
Returns the result of this matrix multiplied by another matrix
combining the geometric effects of the two.
|
|
|
Given a point in the pretransform coordinate space, returns the coordinates of
that point after the transformation occurs.
|
|
|
inverse()
Returns the inverse of the matrix.
|
|
|
rotate(theta, aboutPoint)
Returns a new matrix that corresponds this matrix multiplied by a
a rotation matrix.
|
|
| <static> |
Matrix.rotation(theta, aboutPoint)
Creates a matrix transformation that corresponds to the given rotation,
around (0,0) or the specified point.
|
|
scale(sx, sy, aboutPoint)
Returns a new matrix that corresponds this matrix multiplied by a
a scaling matrix.
|
|
| <static> |
Matrix.scale(sx, sy, aboutPoint)
Returns a matrix that corresponds to scaling by factors of sx, sy along
the x and y axis respectively.
|
|
Returns the result of applying the geometric transformation represented by the
Matrix object to the specified point.
|
|
|
translate(tx, ty)
Translates the matrix along the x and y axes, as specified by the tx and ty parameters.
|
|
| <static> |
Matrix.translation(tx, ty)
Returns a matrix that corresponds to a translation of tx, ty.
|
Class Detail
Matrix(a, b, c, d, tx, ty)
_ _ | a c tx | | b d ty | |_0 0 1 _|Creates a matrix for 2d affine transformations. concat, inverse, rotate, scale and translate return new matrices with the transformations applied. The matrix is not modified in place. Returns the identity matrix when called with no arguments.
- Parameters:
- {Number} a Optional
- {Number} b Optional
- {Number} c Optional
- {Number} d Optional
- {Number} tx Optional
- {Number} ty Optional
Method Detail
{Matrix}
concat(matrix)
Returns the result of this matrix multiplied by another matrix
combining the geometric effects of the two. In mathematical terms,
concatenating two matrixes is the same as combining them using matrix multiplication.
If this matrix is A and the matrix passed in is B, the resulting matrix is A x B
http://mathworld.wolfram.com/MatrixMultiplication.html
- Parameters:
- {Matrix} matrix
- The matrix to multiply this matrix by.
- Returns:
- The result of the matrix multiplication, a new matrix.
{Point}
deltaTransformPoint()
Given a point in the pretransform coordinate space, returns the coordinates of
that point after the transformation occurs. Unlike the standard transformation
applied using the transformPoint() method, the deltaTransformPoint() method's
transformation does not consider the translation parameters tx and ty.
- Returns:
- A new point transformed by this matrix ignoring tx and ty.
- See:
- #transformPoint
{Matrix}
inverse()
Returns the inverse of the matrix.
http://mathworld.wolfram.com/MatrixInverse.html
- Returns:
- A new matrix that is the inverse of this matrix.
{Matrix}
rotate(theta, aboutPoint)
Returns a new matrix that corresponds this matrix multiplied by a
a rotation matrix.
- Parameters:
- {Number} theta
- Amount to rotate in radians.
- {Point} aboutPoint Optional
- The point about which this rotation occurs. Defaults to (0,0).
- Returns:
- A new matrix, rotated by the specified amount.
- See:
- Matrix.rotation
Creates a matrix transformation that corresponds to the given rotation,
around (0,0) or the specified point.
- Parameters:
- {Number} theta
- Rotation in radians.
- {Point} aboutPoint Optional
- The point about which this rotation occurs. Defaults to (0,0).
- Returns:
- See:
- Matrix#rotate
{Matrix}
scale(sx, sy, aboutPoint)
Returns a new matrix that corresponds this matrix multiplied by a
a scaling matrix.
- Parameters:
- {Number} sx
- {Number} sy Optional
- {Point} aboutPoint Optional
- The point that remains fixed during the scaling
- See:
- Matrix.scale
Returns a matrix that corresponds to scaling by factors of sx, sy along
the x and y axis respectively.
If only one parameter is given the matrix is scaled uniformly along both axis.
If the optional aboutPoint parameter is given the scaling takes place
about the given point.
- Parameters:
- {Number} sx
- The amount to scale by along the x axis or uniformly if no sy is given.
- {Number} sy Optional
- The amount to scale by along the y axis.
- {Point} aboutPoint Optional
- The point about which the scaling occurs. Defaults to (0,0).
- Returns:
- A matrix transformation representing scaling by sx and sy.
- See:
- Matrix#scale
{Point}
transformPoint()
Returns the result of applying the geometric transformation represented by the
Matrix object to the specified point.
- Returns:
- A new point with the transformation applied.
- See:
- #deltaTransformPoint
{Matrix}
translate(tx, ty)
Translates the matrix along the x and y axes, as specified by the tx and ty parameters.
- Parameters:
- {Number} tx
- The translation along the x axis.
- {Number} ty
- The translation along the y axis.
- Returns:
- A new matrix with the translation applied.
- See:
- Matrix.translation
Returns a matrix that corresponds to a translation of tx, ty.
- Parameters:
- {Number} tx
- The amount to translate in the x direction.
- {Number} ty
- The amount to translate in the y direction.
- Returns:
- A matrix transformation representing a translation by tx and ty.
- See:
- Matrix#translate