Home

Class goog.graphics.AffineTransform

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

Instance Method Summary
clone() ⇒ !goog.graphics.AffineTransform
concatenate(!goog.graphics.AffineTransform tx) ⇒ !goog.graphics.AffineTransform

Concatenates an affine transform to this transform.

copyFrom(!goog.graphics.AffineTransform tx) ⇒ !goog.graphics.AffineTransform

Sets this transform to be identical to the given transform.

createInverse() ⇒ !goog.graphics.AffineTransform
equals(?goog.graphics.AffineTransform tx) ⇒ boolean

Compares two affine transforms for equality.

getDeterminant() ⇒ number
getScaleX() ⇒ number
getScaleY() ⇒ number
getShearX() ⇒ number
getShearY() ⇒ number
getTranslateX() ⇒ number
getTranslateY() ⇒ number
isIdentity() ⇒ boolean
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.

preConcatenate(!goog.graphics.AffineTransform tx) ⇒ !goog.graphics.AffineTransform

Pre-concatenates an affine transform to this transform.

preRotate(number theta, number x, number y) ⇒ !goog.graphics.AffineTransform

Pre-concatenates this transform with a rotation transformation around an anchor point.

preScale(number sx, number sy) ⇒ !goog.graphics.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]

preShear(number shx, number shy) ⇒ !goog.graphics.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]

preTranslate(number dx, number dy) ⇒ !goog.graphics.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]

rotate(number theta, number x, number y) ⇒ !goog.graphics.AffineTransform

Concatenates this transform with a rotation transformation around an anchor point.

scale(number sx, number sy) ⇒ !goog.graphics.AffineTransform

Concatenates this transform with a scaling transformation.

setToRotation(number theta, number x, number y) ⇒ !goog.graphics.AffineTransform

Sets this transform to a rotation transformation.

setToScale(number sx, number sy) ⇒ !goog.graphics.AffineTransform

Sets this transform to a scaling transformation.

setToShear(number shx, number shy) ⇒ !goog.graphics.AffineTransform

Sets this transform to a shearing transformation.

setToTranslation(number dx, number dy) ⇒ !goog.graphics.AffineTransform

Sets this transform to a translation transformation.

setTransform(number m00, number m10, number m01, number m11, number m02, number m12) ⇒ !goog.graphics.AffineTransform

Sets this transform to the matrix specified by the 6 values.

shear(number shx, number shy) ⇒ !goog.graphics.AffineTransform

Concatenates this transform with a shear transformation.

toString() ⇒ string
transform(!Array src, number srcOff, !Array dst, number dstOff, number numPts)

Transforms an array of coordinates by this transform and stores the result into a destination array.

translate(number dx, number dy) ⇒ !goog.graphics.AffineTransform

Concatenates this transform with a translate transformation.

Static Method Summary
getRotateInstance(number theta, number x, number y) ⇒ !goog.graphics.AffineTransform

Creates a transform representing a rotation transformation.

getScaleInstance(number sx, number sy) ⇒ !goog.graphics.AffineTransform

Creates a transform representing a scaling transformation.

getShearInstance(number shx, number shy) ⇒ !goog.graphics.AffineTransform

Creates a transform representing a shearing transformation.

getTranslateInstance(number dx, number dy) ⇒ !goog.graphics.AffineTransform

Creates a transform representing a translation transformation.