goog.graphics.AffineTransform
Provided By |
---|
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).
new AffineTransform( opt_m00, opt_m10, opt_m01, opt_m11, opt_m02, opt_m12 )
Parameters |
|
---|
Instance Methods
this.clone() → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.concatenate( tx ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Concatenates an affine transform to this transform.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.copyFrom( tx ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Sets this transform to be identical to the given transform.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.createInverse() → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.equals( tx ) → boolean
boolean
Compares two affine transforms for equality.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.getDeterminant() → number
number
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getScaleX() → number
number
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getScaleY() → number
number
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getShearX() → number
number
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getShearY() → number
number
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getTranslateX() → number
number
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getTranslateY() → number
number
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.isIdentity() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.isInvertible() → boolean
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.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.preConcatenate( tx ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Pre-concatenates an affine transform to this transform.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.preRotate( theta, x, y ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Pre-concatenates this transform with a rotation transformation around an anchor point.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.preScale( sx, sy ) → goog.graphics.AffineTransform
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]
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.preShear( shx, shy ) → goog.graphics.AffineTransform
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]
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.preTranslate( dx, dy ) → goog.graphics.AffineTransform
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]
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.rotate( theta, x, y ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Concatenates this transform with a rotation transformation around an anchor point.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.scale( sx, sy ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Concatenates this transform with a scaling transformation.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.setToRotation( theta, x, y ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Sets this transform to a rotation transformation.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.setToScale( sx, sy ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Sets this transform to a scaling transformation.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.setToShear( shx, shy ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Sets this transform to a shearing transformation.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.setToTranslation( dx, dy ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Sets this transform to a translation transformation.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.setTransform( m00, m10, m01, m11, m02, m12 ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Sets this transform to the matrix specified by the 6 values.
Parameters |
| ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.shear( shx, shy ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Concatenates this transform with a shear transformation.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.toString() → string
string
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.transform( src, srcOff, dst, dstOff, numPts ) → void
void
Transforms an array of coordinates by this transform and stores the result into a destination array.
Parameters |
|
---|
this.translate( dx, dy ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Concatenates this transform with a translate transformation.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
Instance Properties
this.m00_ → number
number
No information.
this.m01_ → number
number
No information.
this.m02_ → number
number
No information.
this.m10_ → number
number
No information.
this.m11_ → number
number
No information.
this.m12_ → number
number
No information.
Static Functions
AffineTransform.getRotateInstance( theta, x, y ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Creates a transform representing a rotation transformation.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
AffineTransform.getScaleInstance( sx, sy ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Creates a transform representing a scaling transformation.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
AffineTransform.getShearInstance( shx, shy ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Creates a transform representing a shearing transformation.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
AffineTransform.getTranslateInstance( dx, dy ) → goog.graphics.AffineTransform
goog.graphics.AffineTransform
Creates a transform representing a translation transformation.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|