Class Matrix
<<<<<<< HEAD
Defined in: GameLib.js.
=======
Defined in: gamelib.js.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
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 |
---|---|
<static> |
Matrix.concat(matrix)
|
concat(matrix)
Returns the result of this matrix multiplied by another matrix
combining the geometric effects of the two.
|
|
<static> |
Matrix.deltaTransformPoint(point)
|
<<<<<<< HEAD
Given a point in the pretransform coordinate space, returns the coordinates of
=======
Given a point in the pretransform coordinate space, returns the coordinates of
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
that point after the transformation occurs.
|
|
<static> |
Matrix.inverse()
|
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> |
<<<<<<< HEAD
=======
Matrix.rotate(theta, aboutPoint)
|
<static> |
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Matrix.rotation(theta, aboutPoint)
Creates a matrix transformation that corresponds to the given rotation,
around (0,0) or the specified point.
|
<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.
|
scale(sx, sy, aboutPoint)
Returns a new matrix that corresponds this matrix multiplied by a
a scaling matrix.
|
|
<static> |
<<<<<<< HEAD
Matrix.scale(sx, sy, aboutPoint)
Returns a matrix that corresponds to scaling by factors of sx, sy along
the x and y axis respectively.
=======
Matrix.transformPoint(point)
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
|
<<<<<<< HEAD
Returns the result of applying the geometric transformation represented by the
=======
Returns the result of applying the geometric transformation represented by the
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Matrix object to the specified point.
|
|
<static> |
Matrix.translate(tx, ty)
|
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.
Method Detail
<<<<<<< HEAD
=======
<static>
Matrix.concat(matrix)
- Parameters:
- matrix
{Matrix}
concat(matrix)
Returns the result of this matrix multiplied by another matrix
<<<<<<< HEAD
combining the geometric effects of the two. In mathematical terms,
=======
combining the geometric effects of the two. In mathematical terms,
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
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.
<static>
Matrix.deltaTransformPoint(point)
- Parameters:
- point
{Point}
deltaTransformPoint()
<<<<<<< HEAD
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.
=======
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
does not consider the translation parameters tx and ty.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Returns:
- A new point transformed by this matrix ignoring tx and ty.
- See:
- #transformPoint
<static>
Matrix.inverse()
{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
<static>
Matrix.rotate(theta, aboutPoint)
- Parameters:
- theta
- aboutPoint
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
=======
<static>
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Matrix}
<<<<<<< HEAD
scale(sx, sy, aboutPoint)
Returns a new matrix that corresponds this matrix multiplied by a
a scaling matrix.
=======
Matrix.scale(sx, sy, aboutPoint)
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.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Parameters:
- {Number} sx <<<<<<< HEAD =======
- The amount to scale by along the x axis or uniformly if no sy is given. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- {Number} sy Optional <<<<<<< HEAD =======
- The amount to scale by along the y axis. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- {Point} aboutPoint Optional <<<<<<< HEAD
- The point that remains fixed during the scaling =======
- The point about which the scaling occurs. Defaults to (0,0). >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
-
<<<<<<< HEAD
=======
- Returns:
- A matrix transformation representing scaling by sx and sy. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- See: <<<<<<< HEAD
- Matrix.scale =======
- Matrix#scale >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
<static>
=======
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Matrix}
<<<<<<< HEAD
Matrix.scale(sx, sy, aboutPoint)
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.
=======
scale(sx, sy, aboutPoint)
Returns a new matrix that corresponds this matrix multiplied by a
a scaling matrix.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Parameters:
- {Number} sx <<<<<<< HEAD
- The amount to scale by along the x axis or uniformly if no sy is given. ======= >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- {Number} sy Optional <<<<<<< HEAD
- The amount to scale by along the y axis. ======= >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- {Point} aboutPoint Optional <<<<<<< HEAD
- The point about which the scaling occurs. Defaults to (0,0). =======
- The point that remains fixed during the scaling >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
-
<<<<<<< HEAD
- Returns:
- A matrix transformation representing scaling by sx and sy. ======= >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- See: <<<<<<< HEAD
- Matrix#scale =======
- Matrix.scale >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
<static>
Matrix.transformPoint(point)
- Parameters:
- point
{Point}
transformPoint()
<<<<<<< HEAD
Returns the result of applying the geometric transformation represented by the
=======
Returns the result of applying the geometric transformation represented by the
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Matrix object to the specified point.
- Returns:
- A new point with the transformation applied.
- See:
- #deltaTransformPoint
<static>
Matrix.translate(tx, ty)
- Parameters:
- tx
- ty
{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