APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.javafx.geom.transform

public Class Affine2D

extends AffineBase
Class Inheritance
Imports
com.sun.javafx.geom.Point2D

The Affine2D class represents a 2D affine transform that performs a linear mapping from 2D coordinates to other 2D coordinates that preserves the "straightness" and "parallelness" of lines. Affine transformations can be constructed using sequences of translations, scales, flips, rotations, and shears.

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         ]

Handling 90-Degree Rotations

In some variations of the rotate methods in the Affine2D class, a double-precision argument specifies the angle of rotation in radians. These methods have special handling for rotations of approximately 90 degrees (including multiples such as 180, 270, and 360 degrees), so that the common case of quadrant rotation is handled more efficiently. This special handling can cause angles very close to multiples of 90 degrees to be treated as if they were exact multiples of 90 degrees. For small multiples of 90 degrees the range of angles treated as a quadrant rotation is approximately 0.00000121 degrees wide. This section explains why such special care is needed and how it is implemented.

Since 90 degrees is represented as PI/2 in radians, and since PI is a transcendental (and therefore irrational) number, it is not possible to exactly represent a multiple of 90 degrees as an exact double precision value measured in radians. As a result it is theoretically impossible to describe quadrant rotations (90, 180, 270 or 360 degrees) using these values. Double precision floating point values can get very close to non-zero multiples of PI/2 but never close enough for the sine or cosine to be exactly 0.0, 1.0 or -1.0. The implementations of Math.sin() and Math.cos() correspondingly never return 0.0 for any case other than Math.sin(0.0). These same implementations do, however, return exactly 1.0 and -1.0 for some range of numbers around each multiple of 90 degrees since the correct answer is so close to 1.0 or -1.0 that the double precision significand cannot represent the difference as accurately as it can for numbers that are near 0.0.

The net result of these issues is that if the Math.sin() and Math.cos() methods are used to directly generate the values for the matrix modifications during these radian-based rotation operations then the resulting transform is never strictly classifiable as a quadrant rotation even for a simple case like rotate(Math.PI/2.0), due to minor variations in the matrix caused by the non-0.0 values obtained for the sine and cosine. If these transforms are not classified as quadrant rotations then subsequent code which attempts to optimize further operations based upon the type of the transform will be relegated to its most general implementation.

Because quadrant rotations are fairly common, this class should handle these cases reasonably quickly, both in applying the rotations to the transform and in applying the resulting transform to the coordinates. To facilitate this optimal handling, the methods which take an angle of rotation measured in radians attempt to detect angles that are intended to be quadrant rotations and treat them as such. These methods therefore treat an angle theta as a quadrant rotation if either Math.sin(theta) or Math.cos(theta) returns exactly 1.0 or -1.0. As a rule of thumb, this property holds true for a range of approximately 0.0000000211 radians (or 0.00000121 degrees) around small multiples of Math.PI/2.0.

Version
1.83, 05/05/07

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from com.sun.javafx.geom.transform.AffineBase:
APPLY_2D_DELTA_MASKAPPLY_2D_MASKAPPLY_3DAPPLY_IDENTITYAPPLY_SCALEAPPLY_SHEARAPPLY_TRANSLATEHI_3DHI_IDENTITYHI_SCALEHI_SHEARHI_SHIFTHI_TRANSLATEmxtmxxmxymytmyxmyystatetype

Constructor Summary

AccessConstructor and Description
private
Affine2D(double mxx, double myx, double mxy, double myy, double mxt, double myt, int state)

public
Affine2D()

Constructs a new Affine2D representing the Identity transformation.

public
Affine2D(BaseTransform
the BaseTransform object to copy
Tx
)

Constructs a new Affine2D that uses the same transform as the specified BaseTransform object.

public
Affine2D(float
the X coordinate scaling element of the 3x3 matrix
mxx
,
float
the Y coordinate shearing element of the 3x3 matrix
myx
,
float
the X coordinate shearing element of the 3x3 matrix
mxy
,
float
the Y coordinate scaling element of the 3x3 matrix
myy
,
float
the X coordinate translation element of the 3x3 matrix
mxt
,
float
the Y coordinate translation element of the 3x3 matrix
myt
)

Constructs a new Affine2D from 6 floating point values representing the 6 specifiable entries of the 3x3 transformation matrix.

public
Affine2D(double
the X coordinate scaling element of the 3x3 matrix
mxx
,
double
the Y coordinate shearing element of the 3x3 matrix
myx
,
double
the X coordinate shearing element of the 3x3 matrix
mxy
,
double
the Y coordinate scaling element of the 3x3 matrix
myy
,
double
the X coordinate translation element of the 3x3 matrix
mxt
,
double
the Y coordinate translation element of the 3x3 matrix
myt
)

Constructs a new Affine2D from 6 double precision values representing the 6 specifiable entries of the 3x3 transformation matrix.

Method Summary

Modifier and TypeMethod and Description
private static double
_matround(double matval)

public BaseTransform
public Affine2D

Returns:

a new Affine2D object representing the inverse transformation.
createInverse
()

Implements abstract com.sun.javafx.geom.transform.BaseTransform.createInverse.

Returns an Affine2D object representing the inverse transformation.

public Point2D

Returns:

ptDst, which contains the result of the transformation.
deltaTransform
(Point2D
the distance vector to be delta transformed
ptSrc
,
Point2D
the resulting transformed distance vector
ptDst
)

Transforms the relative distance vector specified by ptSrc and stores the result in ptDst.

public BaseTransform
deriveWithConcatenation(double mxx, double myx, double mxy, double myy, double mxt, double myt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithConcatenation.

public BaseTransform
deriveWithConcatenation(double mxx, double mxy, double mxz, double mxt, double myx, double myy, double myz, double myt, double mzx, double mzy, double mzz, double mzt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithConcatenation.

public BaseTransform
public BaseTransform
public BaseTransform
public BaseTransform
public BaseTransform
deriveWithRotation(double theta, double axisX, double axisY, double axisZ)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithRotation.

public BaseTransform
deriveWithScale(double mxx, double myy, double mzz)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithScale.

public BaseTransform
public BaseTransform
deriveWithTranslation(double mxt, double myt, double mzt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithTranslation.

public boolean

Returns:

true if obj equals this Affine2D object; false otherwise.
equals
(Object
the Object to test for equality with this Affine2D
obj
)

Overrides com.sun.javafx.geom.transform.BaseTransform.equals.

Returns true if this Affine2D represents the same coordinate transform as the specified argument.

public BaseTransform.Degree
public int

Returns:

a hash code for this transform.
hashCode
()

Overrides com.sun.javafx.geom.transform.BaseTransform.hashCode.

Returns the hashcode for this transform.

public boolean
public void
preConcatenate(BaseTransform
the BaseTransform object to be concatenated with this Affine2D object.
Tx
)

Concatenates a BaseTransform Tx to this Affine2D Cx in a less commonly used way such that Tx modifies the coordinate transformation relative to the absolute pixel space rather than relative to the existing user space.

public void
quadrantRotate(int
the number of 90 degree arcs to rotate by
numquadrants
)

Concatenates this transform with a transform that rotates coordinates by the specified number of quadrants.

public void
quadrantRotate(int
the number of 90 degree arcs to rotate by
numquadrants
,
double
the X coordinate of the rotation anchor point
anchorx
,
double
the Y coordinate of the rotation anchor point
anchory
)

Concatenates this transform with a transform that rotates coordinates by the specified number of quadrants around the specified anchor point.

protected void
reset3Delements()

Implements abstract com.sun.javafx.geom.transform.AffineBase.reset3Delements.

Resets the 3D (Z) components of the matrix to identity settings (if they are present).

public void
restoreTransform(double mxx, double myx, double mxy, double myy, double mxt, double myt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.restoreTransform.

This function is only guaranteed to succeed if the transform is of degree AFFINE2D or less and the matrix parameters specified came from this same instance.

public void
restoreTransform(double mxx, double mxy, double mxz, double mxt, double myx, double myy, double myz, double myt, double mzx, double mzy, double mzz, double mzt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.restoreTransform.

This function is only guaranteed to succeed if the matrix parameters specified came from this same instance.

public void
rotate(double
the angle of rotation measured in radians
theta
,
double
the X coordinate of the rotation anchor point
anchorx
,
double
the Y coordinate of the rotation anchor point
anchory
)

Concatenates this transform with a transform that rotates coordinates around an anchor point.

public void
rotate(double
the X coordinate of the rotation vector
vecx
,
double
the Y coordinate of the rotation vector
vecy
)

Concatenates this transform with a transform that rotates coordinates according to a rotation vector.

public void
rotate(double
the X coordinate of the rotation vector
vecx
,
double
the Y coordinate of the rotation vector
vecy
,
double
the X coordinate of the rotation anchor point
anchorx
,
double
the Y coordinate of the rotation anchor point
anchory
)

Concatenates this transform with a transform that rotates coordinates around an anchor point according to a rotation vector.

public void
setToQuadrantRotation(int
the number of 90 degree arcs to rotate by
numquadrants
)

Sets this transform to a rotation transformation that rotates coordinates by the specified number of quadrants.

public void
setToQuadrantRotation(int
the number of 90 degree arcs to rotate by
numquadrants
,
double
the X coordinate of the rotation anchor point
anchorx
,
double
the Y coordinate of the rotation anchor point
anchory
)

Sets this transform to a translated rotation transformation that rotates coordinates by the specified number of quadrants around the specified anchor point.

public void
setToRotation(double
the angle of rotation measured in radians
theta
)

Sets this transform to a rotation transformation.

public void
setToRotation(double
the angle of rotation measured in radians
theta
,
double
the X coordinate of the rotation anchor point
anchorx
,
double
the Y coordinate of the rotation anchor point
anchory
)

Sets this transform to a translated rotation transformation.

public void
setToRotation(double
the X coordinate of the rotation vector
vecx
,
double
the Y coordinate of the rotation vector
vecy
)

Sets this transform to a rotation transformation that rotates coordinates according to a rotation vector.

public void
setToRotation(double
the X coordinate of the rotation vector
vecx
,
double
the Y coordinate of the rotation vector
vecy
,
double
the X coordinate of the rotation anchor point
anchorx
,
double
the Y coordinate of the rotation anchor point
anchory
)

Sets this transform to a rotation transformation that rotates coordinates around an anchor point according to a rotation vector.

public void
setToScale(double
the factor by which coordinates are scaled along the X axis direction
sx
,
double
the factor by which coordinates are scaled along the Y axis direction
sy
)

Sets this transform to a scaling transformation.

public void
setToTranslation(double
the distance by which coordinates are translated in the X axis direction
tx
,
double
the distance by which coordinates are translated in the Y axis direction
ty
)

Sets this transform to a translation transformation.

public void
setTransform(BaseTransform
the BaseTransform object from which to copy the transform
Tx
)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.setTransform.

Sets this transform to a copy of the transform in the specified BaseTransform object.

public String

Returns:

a String representing the value of this Object.
toString
()

Overrides com.sun.javafx.geom.transform.BaseTransform.toString.

Returns a String that represents the value of this Object.

public void
transform(Point2D[]
the array containing the source point objects
ptSrc
,
int
the offset to the first point object to be transformed in the source array
srcOff
,
Point2D[]
the array into which the transform point objects are returned
ptDst
,
int
the offset to the location of the first transformed point object that is stored in the destination array
dstOff
,
int
the number of point objects to be transformed
numPts
)

Transforms an array of point objects by this transform.

Inherited from com.sun.javafx.geom.transform.AffineBase:
calculateTypeconcatenateconcatenatecreateTransformedShapedeltaTransformdeltaTransformdeltaTransformgetDeterminantgetMxtgetMxxgetMxygetMytgetMyxgetMyygetTypeinverseDeltaTransforminverseDeltaTransforminverseTransforminverseTransforminverseTransforminverseTransforminverseTransforminverseTransforminvertisIdentityisTranslateOrIdentityrotaterotate180rotate270rotate90scalesetToIdentitysetToShearsetTransformshearstateErrortransformtransformtransformtransformtransformtransformtransformtransformtransformtranslateupdateStateupdateState2D

Field Detail

BASE_HASHback to summary
private static final long BASE_HASH

Constructor Detail

Affine2Dback to summary
private Affine2D(double mxx, double myx, double mxy, double myy, double mxt, double myt, int state)
Affine2Dback to summary
public Affine2D()

Constructs a new Affine2D representing the Identity transformation.

Affine2Dback to summary
public Affine2D(BaseTransform Tx)

Constructs a new Affine2D that uses the same transform as the specified BaseTransform object.

Parameters
Tx:BaseTransform

the BaseTransform object to copy

Affine2Dback to summary
public Affine2D(float mxx, float myx, float mxy, float myy, float mxt, float myt)

Constructs a new Affine2D from 6 floating point values representing the 6 specifiable entries of the 3x3 transformation matrix.

Parameters
mxx:float

the X coordinate scaling element of the 3x3 matrix

myx:float

the Y coordinate shearing element of the 3x3 matrix

mxy:float

the X coordinate shearing element of the 3x3 matrix

myy:float

the Y coordinate scaling element of the 3x3 matrix

mxt:float

the X coordinate translation element of the 3x3 matrix

myt:float

the Y coordinate translation element of the 3x3 matrix

Affine2Dback to summary
public Affine2D(double mxx, double myx, double mxy, double myy, double mxt, double myt)

Constructs a new Affine2D from 6 double precision values representing the 6 specifiable entries of the 3x3 transformation matrix.

Parameters
mxx:double

the X coordinate scaling element of the 3x3 matrix

myx:double

the Y coordinate shearing element of the 3x3 matrix

mxy:double

the X coordinate shearing element of the 3x3 matrix

myy:double

the Y coordinate scaling element of the 3x3 matrix

mxt:double

the X coordinate translation element of the 3x3 matrix

myt:double

the Y coordinate translation element of the 3x3 matrix

Method Detail

_matroundback to summary
private static double _matround(double matval)
copyback to summary
public BaseTransform copy()

Implements abstract com.sun.javafx.geom.transform.BaseTransform.copy.

Annotations
@Override
createInverseback to summary
public Affine2D createInverse() throws NoninvertibleTransformException

Implements abstract com.sun.javafx.geom.transform.BaseTransform.createInverse.

Returns an Affine2D object representing the inverse transformation. The inverse transform Tx' of this transform Tx maps coordinates transformed by Tx back to their original coordinates. In other words, Tx'(Tx(p)) = p = Tx(Tx'(p)).

If this transform maps all coordinates onto a point or a line then it will not have an inverse, since coordinates that do not lie on the destination point or line will not have an inverse mapping. The getDeterminant method can be used to determine if this transform has no inverse, in which case an exception will be thrown if the createInverse method is called.

Returns:Affine2D

a new Affine2D object representing the inverse transformation.

Annotations
@Override
Exceptions
NoninvertibleTransformException:
if the matrix cannot be inverted.
See Also
getDeterminant
deltaTransformback to summary
public Point2D deltaTransform(Point2D ptSrc, Point2D ptDst)

Transforms the relative distance vector specified by ptSrc and stores the result in ptDst. A relative distance vector is transformed without applying the translation components of the affine transformation matrix using the following equations:

 [  x' ]   [  m00  m01 (m02) ] [  x  ]   [ m00x + m01y ]
 [  y' ] = [  m10  m11 (m12) ] [  y  ] = [ m10x + m11y ]
 [ (1) ]   [  (0)  (0) ( 1 ) ] [ (1) ]   [     (1)     ]
If ptDst is null, a new Point2D object is allocated and then the result of the transform is stored in this object. In either case, ptDst, which contains the transformed point, is returned for convenience. If ptSrc and ptDst are the same object, the input point is correctly overwritten with the transformed point.
Parameters
ptSrc:Point2D

the distance vector to be delta transformed

ptDst:Point2D

the resulting transformed distance vector

Returns:Point2D

ptDst, which contains the result of the transformation.

deriveWithConcatenationback to summary
public BaseTransform deriveWithConcatenation(double mxx, double myx, double mxy, double myy, double mxt, double myt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithConcatenation.

Annotations
@Override
deriveWithConcatenationback to summary
public BaseTransform deriveWithConcatenation(double mxx, double mxy, double mxz, double mxt, double myx, double myy, double myz, double myt, double mzx, double mzy, double mzz, double mzt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithConcatenation.

Annotations
@Override
deriveWithConcatenationback to summary
public BaseTransform deriveWithConcatenation(BaseTransform tx)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithConcatenation.

Annotations
@Override
deriveWithNewTransformback to summary
public BaseTransform deriveWithNewTransform(BaseTransform tx)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithNewTransform.

Annotations
@Override
deriveWithPreConcatenationback to summary
public BaseTransform deriveWithPreConcatenation(BaseTransform tx)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithPreConcatenation.

Annotations
@Override
deriveWithPreTranslationback to summary
public BaseTransform deriveWithPreTranslation(double mxt, double myt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithPreTranslation.

Annotations
@Override
deriveWithRotationback to summary
public BaseTransform deriveWithRotation(double theta, double axisX, double axisY, double axisZ)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithRotation.

Annotations
@Override
deriveWithScaleback to summary
public BaseTransform deriveWithScale(double mxx, double myy, double mzz)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithScale.

Annotations
@Override
deriveWithTranslationback to summary
public BaseTransform deriveWithTranslation(double mxt, double myt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithTranslation.

Annotations
@Override
deriveWithTranslationback to summary
public BaseTransform deriveWithTranslation(double mxt, double myt, double mzt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.deriveWithTranslation.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides com.sun.javafx.geom.transform.BaseTransform.equals.

Returns true if this Affine2D represents the same coordinate transform as the specified argument.

Parameters
obj:Object

the Object to test for equality with this Affine2D

Returns:boolean

true if obj equals this Affine2D object; false otherwise.

Annotations
@Override
getDegreeback to summary
public BaseTransform.Degree getDegree()

Implements abstract com.sun.javafx.geom.transform.BaseTransform.getDegree.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides com.sun.javafx.geom.transform.BaseTransform.hashCode.

Returns the hashcode for this transform. The base algorithm for computing the hashcode is defined by the implementation in the BaseTransform class. This implementation is just a faster way of computing the same value knowing which elements of the transform matrix are populated.

Returns:int

a hash code for this transform.

Annotations
@Override
is2Dback to summary
public boolean is2D()

Overrides com.sun.javafx.geom.transform.AffineBase.is2D.

Annotations
@Override
preConcatenateback to summary
public void preConcatenate(BaseTransform Tx)

Concatenates a BaseTransform Tx to this Affine2D Cx in a less commonly used way such that Tx modifies the coordinate transformation relative to the absolute pixel space rather than relative to the existing user space. Cx is updated to perform the combined transformation. Transforming a point p by the updated transform Cx' is equivalent to first transforming p by the original transform Cx and then transforming the result by Tx like this: Cx'(p) = Tx(Cx(p)) In matrix notation, if this transform Cx is represented by the matrix [this] and Tx is represented by the matrix [Tx] then this method does the following:

     [this] = [Tx] x [this]
Parameters
Tx:BaseTransform

the BaseTransform object to be concatenated with this Affine2D object.

See Also
concatenate
quadrantRotateback to summary
public void quadrantRotate(int numquadrants)

Concatenates this transform with a transform that rotates coordinates by the specified number of quadrants. This is equivalent to calling:

    rotate(numquadrants * Math.PI / 2.0);
Rotating by a positive number of quadrants rotates points on the positive X axis toward the positive Y axis.
Parameters
numquadrants:int

the number of 90 degree arcs to rotate by

quadrantRotateback to summary
public void quadrantRotate(int numquadrants, double anchorx, double anchory)

Concatenates this transform with a transform that rotates coordinates by the specified number of quadrants around the specified anchor point. This method is equivalent to calling:

    rotate(numquadrants * Math.PI / 2.0, anchorx, anchory);
Rotating by a positive number of quadrants rotates points on the positive X axis toward the positive Y axis.
Parameters
numquadrants:int

the number of 90 degree arcs to rotate by

anchorx:double

the X coordinate of the rotation anchor point

anchory:double

the Y coordinate of the rotation anchor point

reset3Delementsback to summary
protected void reset3Delements()

Implements abstract com.sun.javafx.geom.transform.AffineBase.reset3Delements.

Doc from com.sun.javafx.geom.transform.AffineBase.reset3Delements.

Resets the 3D (Z) components of the matrix to identity settings (if they are present). This is a NOP unless the transform is Affine3D in which case it needs to reset its added fields.

Annotations
@Override
restoreTransformback to summary
public void restoreTransform(double mxx, double myx, double mxy, double myy, double mxt, double myt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.restoreTransform.

Doc from com.sun.javafx.geom.transform.BaseTransform.restoreTransform.

This function is only guaranteed to succeed if the transform is of degree AFFINE2D or less and the matrix parameters specified came from this same instance. In practice, they will also tend to succeed if they specify a transform of Degree less than or equal to the Degree of this instance as well, but the intent of this method is to restore the transform that had been read out of this transform into local variables.

Annotations
@Override
restoreTransformback to summary
public void restoreTransform(double mxx, double mxy, double mxz, double mxt, double myx, double myy, double myz, double myt, double mzx, double mzy, double mzz, double mzt)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.restoreTransform.

Doc from com.sun.javafx.geom.transform.BaseTransform.restoreTransform.

This function is only guaranteed to succeed if the matrix parameters specified came from this same instance. In practice, they will also tend to succeed if they specify a transform of Degree less than or equal to the Degree of this instance as well, but the intent of this method is to restore the transform that had been read out of this transform into local variables.

Annotations
@Override
rotateback to summary
public void rotate(double theta, double anchorx, double anchory)

Concatenates this transform with a transform that rotates coordinates around an anchor point. This operation is equivalent to translating the coordinates so that the anchor point is at the origin (S1), then rotating them about the new origin (S2), and finally translating so that the intermediate origin is restored to the coordinates of the original anchor point (S3).

This operation is equivalent to the following sequence of calls:

    translate(anchorx, anchory);      // S3: final translation
    rotate(theta);                    // S2: rotate around anchor
    translate(-anchorx, -anchory);    // S1: translate anchor to origin
Rotating by a positive angle theta rotates points on the positive X axis toward the positive Y axis. Note also the discussion of Handling 90-Degree Rotations above.
Parameters
theta:double

the angle of rotation measured in radians

anchorx:double

the X coordinate of the rotation anchor point

anchory:double

the Y coordinate of the rotation anchor point

rotateback to summary
public void rotate(double vecx, double vecy)

Concatenates this transform with a transform that rotates coordinates according to a rotation vector. All coordinates rotate about the origin by the same amount. The amount of rotation is such that coordinates along the former positive X axis will subsequently align with the vector pointing from the origin to the specified vector coordinates. If both vecx and vecy are 0.0, no additional rotation is added to this transform. This operation is equivalent to calling:

         rotate(Math.atan2(vecy, vecx));
Parameters
vecx:double

the X coordinate of the rotation vector

vecy:double

the Y coordinate of the rotation vector

rotateback to summary
public void rotate(double vecx, double vecy, double anchorx, double anchory)

Concatenates this transform with a transform that rotates coordinates around an anchor point according to a rotation vector. All coordinates rotate about the specified anchor coordinates by the same amount. The amount of rotation is such that coordinates along the former positive X axis will subsequently align with the vector pointing from the origin to the specified vector coordinates. If both vecx and vecy are 0.0, the transform is not modified in any way. This method is equivalent to calling:

    rotate(Math.atan2(vecy, vecx), anchorx, anchory);
Parameters
vecx:double

the X coordinate of the rotation vector

vecy:double

the Y coordinate of the rotation vector

anchorx:double

the X coordinate of the rotation anchor point

anchory:double

the Y coordinate of the rotation anchor point

setToQuadrantRotationback to summary
public void setToQuadrantRotation(int numquadrants)

Sets this transform to a rotation transformation that rotates coordinates by the specified number of quadrants. This operation is equivalent to calling:

    setToRotation(numquadrants * Math.PI / 2.0);
Rotating by a positive number of quadrants rotates points on the positive X axis toward the positive Y axis.
Parameters
numquadrants:int

the number of 90 degree arcs to rotate by

setToQuadrantRotationback to summary
public void setToQuadrantRotation(int numquadrants, double anchorx, double anchory)

Sets this transform to a translated rotation transformation that rotates coordinates by the specified number of quadrants around the specified anchor point. This operation is equivalent to calling:

    setToRotation(numquadrants * Math.PI / 2.0, anchorx, anchory);
Rotating by a positive number of quadrants rotates points on the positive X axis toward the positive Y axis.
Parameters
numquadrants:int

the number of 90 degree arcs to rotate by

anchorx:double

the X coordinate of the rotation anchor point

anchory:double

the Y coordinate of the rotation anchor point

setToRotationback to summary
public void setToRotation(double theta)

Sets this transform to a rotation transformation. The matrix representing this transform becomes:

     [   cos(theta)    -sin(theta)    0   ]
     [   sin(theta)     cos(theta)    0   ]
     [       0              0         1   ]
Rotating by a positive angle theta rotates points on the positive X axis toward the positive Y axis. Note also the discussion of Handling 90-Degree Rotations above.
Parameters
theta:double

the angle of rotation measured in radians

setToRotationback to summary
public void setToRotation(double theta, double anchorx, double anchory)

Sets this transform to a translated rotation transformation. This operation is equivalent to translating the coordinates so that the anchor point is at the origin (S1), then rotating them about the new origin (S2), and finally translating so that the intermediate origin is restored to the coordinates of the original anchor point (S3).

This operation is equivalent to the following sequence of calls:

    setToTranslation(anchorx, anchory); // S3: final translation
    rotate(theta);                      // S2: rotate around anchor
    translate(-anchorx, -anchory);      // S1: translate anchor to origin
The matrix representing this transform becomes:
     [   cos(theta)    -sin(theta)    x-x*cos+y*sin  ]
     [   sin(theta)     cos(theta)    y-x*sin-y*cos  ]
     [       0              0               1        ]
Rotating by a positive angle theta rotates points on the positive X axis toward the positive Y axis. Note also the discussion of Handling 90-Degree Rotations above.
Parameters
theta:double

the angle of rotation measured in radians

anchorx:double

the X coordinate of the rotation anchor point

anchory:double

the Y coordinate of the rotation anchor point

setToRotationback to summary
public void setToRotation(double vecx, double vecy)

Sets this transform to a rotation transformation that rotates coordinates according to a rotation vector. All coordinates rotate about the origin by the same amount. The amount of rotation is such that coordinates along the former positive X axis will subsequently align with the vector pointing from the origin to the specified vector coordinates. If both vecx and vecy are 0.0, the transform is set to an identity transform. This operation is equivalent to calling:

    setToRotation(Math.atan2(vecy, vecx));
Parameters
vecx:double

the X coordinate of the rotation vector

vecy:double

the Y coordinate of the rotation vector

setToRotationback to summary
public void setToRotation(double vecx, double vecy, double anchorx, double anchory)

Sets this transform to a rotation transformation that rotates coordinates around an anchor point according to a rotation vector. All coordinates rotate about the specified anchor coordinates by the same amount. The amount of rotation is such that coordinates along the former positive X axis will subsequently align with the vector pointing from the origin to the specified vector coordinates. If both vecx and vecy are 0.0, the transform is set to an identity transform. This operation is equivalent to calling:

    setToTranslation(Math.atan2(vecy, vecx), anchorx, anchory);
Parameters
vecx:double

the X coordinate of the rotation vector

vecy:double

the Y coordinate of the rotation vector

anchorx:double

the X coordinate of the rotation anchor point

anchory:double

the Y coordinate of the rotation anchor point

setToScaleback to summary
public void setToScale(double sx, double sy)

Sets this transform to a scaling transformation. The matrix representing this transform becomes:

     [   sx   0    0   ]
     [   0    sy   0   ]
     [   0    0    1   ]
Parameters
sx:double

the factor by which coordinates are scaled along the X axis direction

sy:double

the factor by which coordinates are scaled along the Y axis direction

setToTranslationback to summary
public void setToTranslation(double tx, double ty)

Sets this transform to a translation transformation. The matrix representing this transform becomes:

     [   1    0    tx  ]
     [   0    1    ty  ]
     [   0    0    1   ]
Parameters
tx:double

the distance by which coordinates are translated in the X axis direction

ty:double

the distance by which coordinates are translated in the Y axis direction

setTransformback to summary
public void setTransform(BaseTransform Tx)

Implements abstract com.sun.javafx.geom.transform.BaseTransform.setTransform.

Sets this transform to a copy of the transform in the specified BaseTransform object.

Parameters
Tx:BaseTransform

the BaseTransform object from which to copy the transform

Annotations
@Override
toStringback to summary
public String toString()

Overrides com.sun.javafx.geom.transform.BaseTransform.toString.

Returns a String that represents the value of this Object.

Returns:String

a String representing the value of this Object.

Annotations
@Override
transformback to summary
public void transform(Point2D[] ptSrc, int srcOff, Point2D[] ptDst, int dstOff, int numPts)

Transforms an array of point objects by this transform. If any element of the ptDst array is null, a new Point2D object is allocated and stored into that element before storing the results of the transformation.

Note that this method does not take any precautions to avoid problems caused by storing results into Point2D objects that will be used as the source for calculations further down the source array. This method does guarantee that if a specified Point2D object is both the source and destination for the same single point transform operation then the results will not be stored until the calculations are complete to avoid storing the results on top of the operands. If, however, the destination Point2D object for one operation is the same object as the source Point2D object for another operation further down the source array then the original coordinates in that point are overwritten before they can be converted.

Parameters
ptSrc:Point2D[]

the array containing the source point objects

srcOff:int

the offset to the first point object to be transformed in the source array

ptDst:Point2D[]

the array into which the transform point objects are returned

dstOff:int

the offset to the location of the first transformed point object that is stored in the destination array

numPts:int

the number of point objects to be transformed