math.AffineTransform Extends
Creates a 2D affine transform. An affine transform performs a linear mapping from 2D coordinates to other 2D coordinates that preserves the "straightness" and "parallelness" of lines. Such a coordinate transformation can be represented by a 3 row by 3 column matrix with an implied last row of [ 0 0 1 ]. This matrix transforms source coordinates (x,y) into destination coordinates (x',y') by considering them to be a column vector and multiplying the coordinate vector by the matrix according to the following process:
     [ x']   [  m00  m01  m02  ] [ x ]   [ m00x + m01y + m02 ]
     [ y'] = [  m10  m11  m12  ] [ y ] = [ m10x + m11y + m12 ]
     [ 1 ]   [   0    0    1   ] [ 1 ]   [         1         ]
This class is optimized for speed and minimizes calculations based on its knowledge of the underlying matrix (as opposed to say simply performing matrix multiplication).

Inheritance

Constructor

goog.math.AffineTransform(opt_m00opt_m10opt_m01opt_m11opt_m02opt_m12)

Parameters

opt_m00 : number=
The m00 coordinate of the transform.
opt_m10 : number=
The m10 coordinate of the transform.
opt_m01 : number=
The m01 coordinate of the transform.
opt_m11 : number=
The m11 coordinate of the transform.
opt_m02 : number=
The m02 coordinate of the transform.
opt_m12 : number=
The m12 coordinate of the transform.

Instance Methods

Public Protected Private
No description.
Returns: !goog.math.AffineTransform  A copy of this transform.
code »
concatenate(tx) !goog.math.AffineTransform
Concatenates an affine transform to this transform.
Arguments:
tx : !goog.math.AffineTransform
The transform to concatenate.
Returns: !goog.math.AffineTransform  This affine transform.
code »
copyFrom(tx) !goog.math.AffineTransform
Sets this transform to be identical to the given transform.
Arguments:
tx : !goog.math.AffineTransform
The transform to copy.
Returns: !goog.math.AffineTransform  This affine transform.
code »
createInverse() !goog.math.AffineTransform
No description.
Returns: !goog.math.AffineTransform  An AffineTransform object representing the inverse transformation.
code »
equals(tx) boolean
Compares two affine transforms for equality.
Arguments:
tx : goog.math.AffineTransform
The other affine transform.
Returns: boolean  whether the two transforms are equal.
code »
getDeterminant() number
No description.
Returns: number  The determinant of this transform.
code »
getScaleX() number
No description.
Returns: number  The scaling factor in the x-direction (m00).
code »
getScaleY() number
No description.
Returns: number  The scaling factor in the y-direction (m11).
code »
getShearX() number
No description.
Returns: number  The shear factor in the x-direction (m01).
code »
getShearY() number
No description.
Returns: number  The shear factor in the y-direction (m10).
code »
getTranslateX() number
No description.
Returns: number  The translation in the x-direction (m02).
code »
getTranslateY() number
No description.
Returns: number  The translation in the y-direction (m12).
code »
isIdentity() boolean
No description.
Returns: boolean  Whether this transform is the identity transform.
code »
isInvertible() boolean
Returns whether the transform is invertible. A transform is not invertible if the determinant is 0 or any value is non-finite or NaN.
Returns: boolean  Whether the transform is invertible.
code »
preConcatenate(tx) !goog.math.AffineTransform
Pre-concatenates an affine transform to this transform.
Arguments:
tx : !goog.math.AffineTransform
The transform to preconcatenate.
Returns: !goog.math.AffineTransform  This affine transform.
code »
preRotate(thetaxy) !goog.math.AffineTransform
Pre-concatenates this transform with a rotation transformation around an anchor point.
Arguments:
theta : number
The angle of rotation measured in radians.
x : number
The x coordinate of the anchor point.
y : number
The y coordinate of the anchor point.
Returns: !goog.math.AffineTransform  This affine transform.
code »
preScale(sxsy) !goog.math.AffineTransform
Pre-concatenates this transform with a scaling transformation, i.e. calculates the following matrix product:
[sx  0 0] [m00 m01 m02]
[ 0 sy 0] [m10 m11 m12]
[ 0  0 1] [  0   0   1]
Arguments:
sx : number
The x-axis scaling factor.
sy : number
The y-axis scaling factor.
Returns: !goog.math.AffineTransform  This affine transform.
code »
preShear(shxshy) !goog.math.AffineTransform
Pre-concatenates this transform with a shear transformation. i.e. calculates the following matrix product:
[  1 shx 0] [m00 m01 m02]
[shy   1 0] [m10 m11 m12]
[  0   0 1] [  0   0   1]
Arguments:
shx : number
The x shear factor.
shy : number
The y shear factor.
Returns: !goog.math.AffineTransform  This affine transform.
code »
preTranslate(dxdy) !goog.math.AffineTransform
Pre-concatenates this transform with a translate transformation, i.e. calculates the following matrix product:
[1 0 dx] [m00 m01 m02]
[0 1 dy] [m10 m11 m12]
[0 0  1] [  0   0   1]
Arguments:
dx : number
The distance to translate in the x direction.
dy : number
The distance to translate in the y direction.
Returns: !goog.math.AffineTransform  This affine transform.
code »
rotate(thetaxy) !goog.math.AffineTransform
Concatenates this transform with a rotation transformation around an anchor point.
Arguments:
theta : number
The angle of rotation measured in radians.
x : number
The x coordinate of the anchor point.
y : number
The y coordinate of the anchor point.
Returns: !goog.math.AffineTransform  This affine transform.
code »
scale(sxsy) !goog.math.AffineTransform
Concatenates this transform with a scaling transformation.
Arguments:
sx : number
The x-axis scaling factor.
sy : number
The y-axis scaling factor.
Returns: !goog.math.AffineTransform  This affine transform.
code »
setToRotation(thetaxy) !goog.math.AffineTransform
Sets this transform to a rotation transformation.
Arguments:
theta : number
The angle of rotation measured in radians.
x : number
The x coordinate of the anchor point.
y : number
The y coordinate of the anchor point.
Returns: !goog.math.AffineTransform  This affine transform.
code »
setToScale(sxsy) !goog.math.AffineTransform
Sets this transform to a scaling transformation.
Arguments:
sx : number
The x-axis scaling factor.
sy : number
The y-axis scaling factor.
Returns: !goog.math.AffineTransform  This affine transform.
code »
setToShear(shxshy) !goog.math.AffineTransform
Sets this transform to a shearing transformation.
Arguments:
shx : number
The x-axis shear factor.
shy : number
The y-axis shear factor.
Returns: !goog.math.AffineTransform  This affine transform.
code »
setToTranslation(dxdy) !goog.math.AffineTransform
Sets this transform to a translation transformation.
Arguments:
dx : number
The distance to translate in the x direction.
dy : number
The distance to translate in the y direction.
Returns: !goog.math.AffineTransform  This affine transform.
code »
setTransform(m00m10m01m11m02m12) !goog.math.AffineTransform
Sets this transform to the matrix specified by the 6 values.
Arguments:
m00 : number
The m00 coordinate of the transform.
m10 : number
The m10 coordinate of the transform.
m01 : number
The m01 coordinate of the transform.
m11 : number
The m11 coordinate of the transform.
m02 : number
The m02 coordinate of the transform.
m12 : number
The m12 coordinate of the transform.
Returns: !goog.math.AffineTransform  This affine transform.
code »
shear(shxshy) !goog.math.AffineTransform
Concatenates this transform with a shear transformation.
Arguments:
shx : number
The x shear factor.
shy : number
The y shear factor.
Returns: !goog.math.AffineTransform  This affine transform.
code »
toString() string
No description.
Returns: string  A string representation of this transform. The format of of the string is compatible with SVG matrix notation, i.e. "matrix(a,b,c,d,e,f)".
code »
transform(srcsrcOffdstdstOffnumPts)
Transforms an array of coordinates by this transform and stores the result into a destination array.
Arguments:
src : !Array.<number>
The array containing the source points as x, y value pairs.
srcOff : number
The offset to the first point to be transformed.
dst : !Array.<number>
The array into which to store the transformed point pairs.
dstOff : number
The offset of the location of the first transformed point in the destination array.
numPts : number
The number of points to tranform.
code »
translate(dxdy) !goog.math.AffineTransform
Concatenates this transform with a translate transformation.
Arguments:
dx : number
The distance to translate in the x direction.
dy : number
The distance to translate in the y direction.
Returns: !goog.math.AffineTransform  This affine transform.
code »

Instance Properties

m00_ :
No description.
Code »
m01_ :
No description.
Code »
m02_ :
No description.
Code »
m10_ :
No description.
Code »
m11_ :
No description.
Code »
m12_ :
No description.
Code »

Static Methods

goog.math.AffineTransform.getRotateInstance(thetaxy) !goog.math.AffineTransform
Creates a transform representing a rotation transformation.
Arguments:
theta : number
The angle of rotation measured in radians.
x : number
The x coordinate of the anchor point.
y : number
The y coordinate of the anchor point.
Returns: !goog.math.AffineTransform  A transform representing a rotation transformation.
code »
goog.math.AffineTransform.getScaleInstance(sxsy) !goog.math.AffineTransform
Creates a transform representing a scaling transformation.
Arguments:
sx : number
The x-axis scaling factor.
sy : number
The y-axis scaling factor.
Returns: !goog.math.AffineTransform  A transform representing a scaling transformation.
code »
goog.math.AffineTransform.getShearInstance(shxshy) !goog.math.AffineTransform
Creates a transform representing a shearing transformation.
Arguments:
shx : number
The x-axis shear factor.
shy : number
The y-axis shear factor.
Returns: !goog.math.AffineTransform  A transform representing a shearing transformation.
code »
goog.math.AffineTransform.getTranslateInstance(dxdy) !goog.math.AffineTransform
Creates a transform representing a translation transformation.
Arguments:
dx : number
The distance to translate in the x direction.
dy : number
The distance to translate in the y direction.
Returns: !goog.math.AffineTransform  A transform representing a translation transformation.
code »

Package math

Package Reference