graphics.AffineTransform Extends Object
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

Object
     goog.graphics.AffineTransform

Constructor

goog.graphics.AffineTransform(opt_m00opt_m10opt_m01opt_m11opt_m02opt_m12)

Parameters

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

Instance Methods

Public Protected Private
No description.
Returns:   A copy of this transform.
code »
concatenate(tx)
Concatenates an affine transform to this transform.
Arguments:
tx :
The transform to concatenate.
Returns:   This affine transform.
code »
copyFrom(tx)
Sets this transform to be identical to the given transform.
Arguments:
tx :
The transform to copy.
Returns:   This affine transform.
code »
createInverse()
No description.
Returns:   An AffineTransform object representing the inverse transformation.
code »
getDeterminant()
No description.
Returns:   The determinant of this transform.
code »
getScaleX()
No description.
Returns:   The scaling factor in the x-direction (m00).
code »
getScaleY()
No description.
Returns:   The scaling factor in the y-direction (m11).
code »
getShearX()
No description.
Returns:   The shear factor in the x-direction (m01).
code »
getShearY()
No description.
Returns:   The shear factor in the y-direction (m10).
code »
getTranslateX()
No description.
Returns:   The translation in the x-direction (m02).
code »
getTranslateY()
No description.
Returns:   The translation in the y-direction (m12).
code »
isIdentity()
No description.
Returns:   Whether this transform is the identity transform.
code »
isInvertible()
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:   Whether the transform is invertible.
code »
preConcatenate(tx)
Pre-concatenates an affine transform to this transform.
Arguments:
tx :
The transform to preconcatenate.
Returns:   This affine transform.
code »
rotate(thetaxy)
Concatentates this transform with a rotation transformation around an anchor point.
Arguments:
theta :
The angle of rotation measured in radians.
x :
The x coordinate of the anchor point.
y :
The y coordinate of the anchor point.
Returns:   This affine transform.
code »
scale(sxsy)
Concatentates this transform with a scaling transformation.
Arguments:
sx :
The x-axis scaling factor.
sy :
The y-axis scaling factor.
Returns:   This affine transform.
code »
setToRotation(thetaxy)
Sets this transform to a rotation transformation.
Arguments:
theta :
The angle of rotation measured in radians.
x :
The x coordinate of the anchor point.
y :
The y coordinate of the anchor point.
Returns:   This affine transform.
code »
setToScale(sxsy)
Sets this transform to a scaling transformation.
Arguments:
sx :
The x-axis scaling factor.
sy :
The y-axis scaling factor.
Returns:   This affine transform.
code »
setToShear(shxshy)
Sets this transform to a shearing transformation.
Arguments:
shx :
The x-axis shear factor.
shy :
The y-axis shear factor.
Returns:   This affine transform.
code »
setToTranslation(dxdy)
Sets this transform to a translation transformation.
Arguments:
dx :
The distance to translate in the x direction.
dy :
The distance to translate in the y direction.
Returns:   This affine transform.
code »
setTransform(m00m10m01m11m02m12)
Sets this transform to the matrix specified by the 6 values.
Arguments:
m00 :
The m00 coordinate of the transform.
m10 :
The m10 coordinate of the transform.
m01 :
The m01 coordinate of the transform.
m11 :
The m11 coordinate of the transform.
m02 :
The m02 coordinate of the transform.
m12 :
The m12 coordinate of the transform.
Returns:   This affine transform.
code »
shear(shxshy)
Concatentates this transform with a shear transformation.
Arguments:
shx :
The x shear factor.
shy :
The y shear factor.
Returns:   This affine transform.
code »
toString()
No description.
Returns:   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 :
The array containing the source points as x, y value pairs.
srcOff :
The offset to the first point to be transformed.
dst :
The array into which to store the transformed point pairs.
dstOff :
The offset of the location of the first transformed point in the destination array.
numPts :
The number of points to tranform.
code »
translate(dxdy)
Concatentates this transform with a translate transformation.
Arguments:
dx :
The distance to translate in the x direction.
dy :
The distance to translate in the y direction.
Returns:   This affine transform.
code »

Static Methods

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

Package graphics

Package Reference