The Affine class represents a general affine transform. An affine
transform performs a linear mapping from 2D/3D coordinates to other 2D/3D
coordinates while preserving the "straightness" and "parallelness"
of lines.
Affine transformations can be constructed using sequence rotations,
translations, scales, and shears.
For simple transformations application developers should use the
specific Translate, Scale, Rotate, or Shear
transforms, which are more lightweight and thus more optimal for this simple
purpose. The Affine class, on the other hand, has the advantage
of being able to represent a general affine transform and perform matrix
operations on it in place, so it fits better for more complex transformation
usages.
Such a coordinate transformation can be represented by a 3 row by
4 column matrix. This matrix transforms source coordinates (x,y,z)
into destination coordinates (x',y',z') by considering
them to be a column vector and multiplying the coordinate vector
by the matrix according to the following process:
[ x'] [ mxx mxy mxz tx ] [ x ] [ mxx * x + mxy * y + mxz * z + tx ]
[ y'] = [ myx myy myz ty ] [ y ] = [ myx * x + myy * y + myz * z + ty ]
[ z'] [ mzx mzy mzz tz ] [ z ] [ mzx * x + mzy * y + mzz * z + tz ]
[ 1 ]
| Modifier and Type | Class and Description |
|---|---|
| private class | Affine.
Keeps track of the atomic changes of more elements. |
| private class | Affine.
Affine element property which handles the atomic changes of more properties. |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | APPLY_3D_COMPLEX
This constant is used for the internal state3d variable to indicate that the matrix is not in any of the recognized simple states and therefore needs a full usage of all elements to complete the transformation equation of this transform. |
| private static final int | APPLY_IDENTITY
This constant is used for the internal state2d variable to indicate that no calculations need to be performed and that the source coordinates only need to be copied to their destinations to complete the transformation equation of this transform. |
| private static final int | APPLY_NON_3D
This constant is used for the internal state3d variable to indicate that the matrix represents a 2D-only transform. |
| private static final int | APPLY_SCALE
This constant is used for the internal state2d and state3d variables to indicate that the scaling components of the matrix need to be factored in to complete the transformation equation of this transform. |
| private static final int | APPLY_SHEAR
This constant is used for the internal state2d variable to indicate that the shearing components of the matrix (mxy and myx) need to be factored in to complete the transformation equation of this transform. |
| private static final int | APPLY_TRANSLATE
This constant is used for the internal state2d and state3d variables that the translation components of the matrix need to be added to complete the transformation equation of this transform. |
| pack-priv Affine. | atomicChange
Tracks atomic changes of more elements. |
| private Affine. | mxx
Defines the X coordinate scaling element of the 3x4 matrix. |
| private Affine. | mxy
Defines the XY coordinate element of the 3x4 matrix. |
| private Affine. | mxz
Defines the XZ coordinate element of the 3x4 matrix. |
| private Affine. | myx
Defines the YX coordinate element of the 3x4 matrix. |
| private Affine. | myy
Defines the Y coordinate scaling element of the 3x4 matrix. |
| private Affine. | myz
Defines the YZ coordinate element of the 3x4 matrix. |
| private Affine. | mzx
Defines the ZX coordinate element of the 3x4 matrix. |
| private Affine. | mzy
Defines the ZY coordinate element of the 3x4 matrix. |
| private Affine. | mzz
Defines the Z coordinate scaling element of the 3x4 matrix. |
| private static final int[] | rot90conversion
Table of 2D state changes during predictable quadrant rotations where the shear and scaleAffine values are swapped and negated. |
| private transient int | state2d
If this is a 2D transform, this field keeps track of which components of the matrix need to be applied when performing a transformation. |
| private transient int | state3d
This field keeps track of whether or not this transform is 3D and if so it tracks several simple states that can be treated faster. |
| private Affine. | tx
Defines the X coordinate translation element of the 3x4 matrix. |
| private Affine. | ty
Defines the Y coordinate translation element of the 3x4 matrix. |
| private Affine. | tz
Defines the Z coordinate translation element of the 3x4 matrix. |
| private double | |
| private double | |
| private double | |
| private double | |
| private double | |
| private double | |
| private double | |
| private double | |
| private double | |
| private double | |
| private double | |
| private double |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | Affine(double
the X coordinate scaling element mxx, double the XY coordinate element mxy, double the X coordinate translation element tx, double the YX coordinate element myx, double the Y coordinate scaling element myy, double the Y coordinate translation element ty)Creates a new instance of |
| public | Affine(double
the X coordinate scaling element mxx, double the XY coordinate element mxy, double the XZ coordinate element mxz, double the X coordinate translation element tx, double the YX coordinate element myx, double the Y coordinate scaling element myy, double the YZ coordinate element myz, double the Y coordinate translation element ty, double the ZX coordinate element mzx, double the ZY coordinate element mzy, double the Z coordinate scaling element mzz, double the Z coordinate translation element tz)Creates a new instance of |
| public | Affine(double[]
array containing the flattened transformation matrix matrix, MatrixType type of matrix contained in the array type, int offset of the first element in the array offset)Creates a new instance of |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | append(double
the X coordinate scaling element of the transform to be
appended mxx, double the XY coordinate element of the transform to be appended mxy, double the X coordinate translation element of the transform to be
appended tx, double the YX coordinate element of the transform to be appended myx, double the Y coordinate scaling element of the transform to be
appended myy, double the Y coordinate translation element of the transform to be
appended ty)Appends the 2D transform specified by the element values to this instance. |
| public void | append(double
the X coordinate scaling element of the transform to be
appended mxx, double the XY coordinate element of the transform to be appended mxy, double the XZ coordinate element of the transform to be appended mxz, double the X coordinate translation element of the transform to be
appended tx, double the YX coordinate element of the transform to be appended myx, double the Y coordinate scaling element of the transform to be
appended myy, double the YZ coordinate element of the transform to be appended myz, double the Y coordinate translation element of the transform to be
appended ty, double the ZX coordinate element of the transform to be appended mzx, double the ZY coordinate element of the transform to be appended mzy, double the Z coordinate scaling element of the transform to be
appended mzz, double the Z coordinate translation element of the transform to be
appended tz)Appends the transform specified by the element values to this instance. |
| public void | append(double[]
array containing the flattened transformation matrix
to be appended matrix, MatrixType type of matrix contained in the array type, int offset of the first matrix element in the array offset)Appends the transform specified by the array to this instance. |
| public void | appendRotation(double
the angle of the rotation in degrees angle)Appends the 2D rotation to this instance. |
| public void | appendRotation(double
the angle of the rotation in degrees angle, double the X coordinate of the rotation pivot point pivotX, double the Y coordinate of the rotation pivot point pivotY)Appends the 2D rotation with pivot to this instance. |
| public void | appendRotation(double
the angle of the rotation in degrees angle, Point2D the rotation pivot point pivot)Appends the 2D rotation with pivot to this instance. |
| public void | appendRotation(double
the angle of the rotation in degrees angle, double the X coordinate of the rotation pivot point pivotX, double the Y coordinate of the rotation pivot point pivotY, double the Z coordinate of the rotation pivot point pivotZ, double the X coordinate magnitude of the rotation axis axisX, double the Y coordinate magnitude of the rotation axis axisY, double the Z coordinate magnitude of the rotation axis axisZ)Appends the rotation to this instance. |
| public void | appendRotation(double
the angle of the rotation in degrees angle, double the X coordinate of the rotation pivot point pivotX, double the Y coordinate of the rotation pivot point pivotY, double the Z coordinate of the rotation pivot point pivotZ, Point3D the rotation axis axis)Appends the rotation to this instance. |
| public void | appendRotation(double
the angle of the rotation in degrees angle, Point3D the rotation pivot point pivot, Point3D the rotation axis axis)Appends the rotation to this instance. |
| public void | appendScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy)Appends the 2D scale to this instance. |
| public void | appendScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, double the X coordinate of the point about which the scale occurs pivotX, double the Y coordinate of the point about which the scale occurs pivotY)Appends the 2D scale with pivot to this instance. |
| public void | appendScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, Point2D the point about which the scale occurs pivot)Appends the 2D scale with pivot to this instance. |
| public void | appendScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, double the Z coordinate scale factor sz)Appends the scale to this instance. |
| public void | appendScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, double the Z coordinate scale factor sz, double the X coordinate of the point about which the scale occurs pivotX, double the Y coordinate of the point about which the scale occurs pivotY, double the Z coordinate of the point about which the scale occurs pivotZ)Appends the scale with pivot to this instance. |
| public void | appendScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, double the Z coordinate scale factor sz, Point3D the point about which the scale occurs pivot)Appends the scale with pivot to this instance. |
| public void | appendShear(double
the XY coordinate element shx, double the YX coordinate element shy)Appends the shear to this instance. |
| public void | appendShear(double
the XY coordinate element shx, double the YX coordinate element shy, double the X coordinate of the shear pivot point pivotX, double the Y coordinate of the shear pivot point pivotY)Appends the shear with pivot to this instance. |
| public void | appendShear(double
the XY coordinate element shx, double the YX coordinate element shy, Point2D the shear pivot point pivot)Appends the shear with pivot to this instance. |
| pack-priv void | appendTo(Affine a)
Overrides javafx. Visitor from |
| public void | appendTranslation(double
the X coordinate translation tx, double the Y coordinate translation ty)Appends the 2D translation to this instance. |
| public void | appendTranslation(double
the X coordinate translation tx, double the Y coordinate translation ty, double the Z coordinate translation tz)Appends the translation to this instance. |
| pack-priv void | |
| pack-priv boolean | |
| public Affine | |
| pack-priv boolean | computeIs2D()
Overrides javafx. Computes if this transform is currently a 2D transform (has no effect in the direction of Z axis). |
| pack-priv boolean | computeIsIdentity()
Overrides javafx. Computes if this transform is currently an identity (has no effect in any direction). |
| public Transform | createConcatenation(Transform transform)
Overrides javafx. Returns the concatenation of this transform and the specified transform. |
| public Affine | createInverse()
Overrides javafx. Returns the inverse transform of this transform. |
| public Point2D | deltaTransform(double x, double y)
Overrides javafx. Transforms the relative magnitude vector by this transform. |
| public Point3D | deltaTransform(double x, double y, double z)
Overrides javafx. Transforms the relative magnitude vector by this transform. |
| pack-priv BaseTransform | |
| public double | determinant()
Overrides javafx. Computes determinant of the transformation matrix. |
| private double | |
| private double | |
| public final double | getMxx()
Overrides javafx. Gets the X coordinate scaling element of the 3x4 matrix. |
| public final double | getMxy()
Overrides javafx. Gets the XY coordinate element of the 3x4 matrix. |
| public final double | getMxz()
Overrides javafx. Gets the XZ coordinate element of the 3x4 matrix. |
| public final double | getMyx()
Overrides javafx. Gets the YX coordinate element of the 3x4 matrix. |
| public final double | getMyy()
Overrides javafx. Gets the Y coordinate scaling element of the 3x4 matrix. |
| public final double | getMyz()
Overrides javafx. Gets the YZ coordinate element of the 3x4 matrix. |
| public final double | getMzx()
Overrides javafx. Gets the ZX coordinate element of the 3x4 matrix. |
| public final double | getMzy()
Overrides javafx. Gets the ZY coordinate element of the 3x4 matrix. |
| public final double | getMzz()
Overrides javafx. Gets the Z coordinate scaling element of the 3x4 matrix. |
| pack-priv int | |
| pack-priv int | |
| public final double | getTx()
Overrides javafx. Gets the X coordinate translation element of the 3x4 matrix. |
| public final double | getTy()
Overrides javafx. Gets the Y coordinate translation element of the 3x4 matrix. |
| public final double | getTz()
Overrides javafx. Gets the Z coordinate translation element of the 3x4 matrix. |
| public Point2D | inverseDeltaTransform(double x, double y)
Overrides javafx. Transforms the relative magnitude vector by the inverse of this transform. |
| public Point3D | inverseDeltaTransform(double x, double y, double z)
Overrides javafx. Transforms the relative magnitude vector by the inverse of this transform. |
| public Point2D | inverseTransform(double x, double y)
Overrides javafx. Transforms the specified point by the inverse of this transform. |
| public Point3D | inverseTransform(double x, double y, double z)
Overrides javafx. Transforms the specified point by the inverse of this transform. |
| pack-priv void | inverseTransform2DPointsImpl(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Overrides javafx. Core of the inverseTransform2DPoints method. |
| pack-priv void | inverseTransform3DPointsImpl(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Overrides javafx. Core of the inverseTransform3DPoints method. |
| public void | |
| private void | |
| private void | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| private void | postProcessChange()
Called by each element property after value change to update the state variables and call transform change notifications. |
| public void | |
| public void | prepend(double
the X coordinate scaling element of the transform to be
prepended mxx, double the XY coordinate element of the transform to be prepended mxy, double the X coordinate translation element of the transform to be
prepended tx, double the YX coordinate element of the transform to be prepended myx, double the Y coordinate scaling element of the transform to be
prepended myy, double the Y coordinate translation element of the transform to be
prepended ty)Prepends the 2D transform specified by the element values to this instance. |
| public void | prepend(double
the X coordinate scaling element of the transform to be
prepended mxx, double the XY coordinate element of the transform to be prepended mxy, double the XZ coordinate element of the transform to be prepended mxz, double the X coordinate translation element of the transform to be
prepended tx, double the YX coordinate element of the transform to be prepended myx, double the Y coordinate scaling element of the transform to be
prepended myy, double the YZ coordinate element of the transform to be prepended myz, double the Y coordinate translation element of the transform to be
prepended ty, double the ZX coordinate element of the transform to be prepended mzx, double the ZY coordinate element of the transform to be prepended mzy, double the Z coordinate scaling element of the transform to be
prepended mzz, double the Z coordinate translation element of the transform to be
prepended tz)Prepends the transform specified by the element values to this instance. |
| public void | prepend(double[]
array containing the flattened transformation matrix
to be prepended matrix, MatrixType type of matrix contained in the array type, int offset of the first matrix element in the array offset)Prepends the transform specified by the array to this instance. |
| public void | prependRotation(double
the angle of the rotation in degrees angle)Prepends the 2D rotation to this instance. |
| public void | prependRotation(double
the angle of the rotation in degrees angle, double the X coordinate of the rotation pivot point pivotX, double the Y coordinate of the rotation pivot point pivotY)Prepends the 2D rotation with pivot to this instance. |
| public void | prependRotation(double
the angle of the rotation in degrees angle, Point2D the rotation pivot point pivot)Prepends the 2D rotation with pivot to this instance. |
| public void | prependRotation(double
the angle of the rotation in degrees angle, double the X coordinate of the rotation pivot point pivotX, double the Y coordinate of the rotation pivot point pivotY, double the Z coordinate of the rotation pivot point pivotZ, double the X coordinate magnitude of the rotation axis axisX, double the Y coordinate magnitude of the rotation axis axisY, double the Z coordinate magnitude of the rotation axis axisZ)Prepends the rotation to this instance. |
| public void | prependRotation(double
the angle of the rotation in degrees angle, double the X coordinate of the rotation pivot point pivotX, double the Y coordinate of the rotation pivot point pivotY, double the Z coordinate of the rotation pivot point pivotZ, Point3D the rotation axis axis)Prepends the rotation to this instance. |
| public void | prependRotation(double
the angle of the rotation in degrees angle, Point3D the rotation pivot point pivot, Point3D the rotation axis axis)Prepends the rotation to this instance. |
| public void | prependScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy)Prepends the 2D scale to this instance. |
| public void | prependScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, double the X coordinate of the point about which the scale occurs pivotX, double the Y coordinate of the point about which the scale occurs pivotY)Prepends the 2D scale with pivot to this instance. |
| public void | prependScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, Point2D the point about which the scale occurs pivot)Prepends the 2D scale with pivot to this instance. |
| public void | prependScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, double the Z coordinate scale factor sz)Prepends the scale to this instance. |
| public void | prependScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, double the Z coordinate scale factor sz, double the X coordinate of the point about which the scale occurs pivotX, double the Y coordinate of the point about which the scale occurs pivotY, double the Z coordinate of the point about which the scale occurs pivotZ)Prepends the scale with pivot to this instance. |
| public void | prependScale(double
the X coordinate scale factor sx, double the Y coordinate scale factor sy, double the Z coordinate scale factor sz, Point3D the point about which the scale occurs pivot)Prepends the scale with pivot to this instance. |
| public void | prependShear(double
the XY coordinate element shx, double the YX coordinate element shy)Prepends the shear to this instance. |
| public void | prependShear(double
the XY coordinate element shx, double the YX coordinate element shy, double the X coordinate of the shear pivot point pivotX, double the Y coordinate of the shear pivot point pivotY)Prepends the shear with pivot to this instance. |
| public void | prependShear(double
the XY coordinate element shx, double the YX coordinate element shy, Point2D the shear pivot point pivot)Prepends the shear with pivot to this instance. |
| pack-priv void | prependTo(Affine a)
Overrides javafx. Visitor from |
| public void | prependTranslation(double
the X coordinate translation tx, double the Y coordinate translation ty, double the Z coordinate translation tz)Prepends the translation to this instance. |
| public void | prependTranslation(double
the X coordinate translation tx, double the Y coordinate translation ty)Prepends the 2D translation to this instance. |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | preRotate3D(double angle, double axisX, double axisY, double axisZ)
Implementation of the |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | rotate3D(double angle, double axisX, double axisY, double axisZ)
Implementation of the |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| public void | setElement(MatrixType
type of matrix to work with type, int zero-based row number row, int zero-based column number column, double new value of the specified transformation matrix element value)Sets the specified element of the transformation matrix. |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public void | |
| public void | setToTransform(Transform
transform whose matrix is to be filled to this instance transform)Sets the values of this instance to the values provided by the specified transform. |
| public void | setToTransform(double
the X coordinate scaling element mxx, double the XY coordinate element mxy, double the X coordinate translation element tx, double the YX coordinate element myx, double the Y coordinate scaling element myy, double the Y coordinate translation element ty)Sets the values of this instance to the 2D transform specified by the element values. |
| public void | setToTransform(double
the X coordinate scaling element mxx, double the XY coordinate element mxy, double the XZ coordinate element mxz, double the X coordinate translation element tx, double the YX coordinate element myx, double the Y coordinate scaling element myy, double the YZ coordinate element myz, double the Y coordinate translation element ty, double the ZX coordinate element mzx, double the ZY coordinate element mzy, double the Z coordinate scaling element mzz, double the Z coordinate translation element tz)Sets the values of this instance to the transform specified by the element values. |
| public void | setToTransform(double[]
array containing the flattened transformation matrix matrix, MatrixType type of matrix contained in the array type, int offset of the first element in the array offset)Sets the values of this instance to the transformation matrix specified by an array. |
| public final void | |
| public final void | |
| public final void | |
| private void | |
| private void | |
| private static void | stateError()
Convenience method used internally to throw exceptions when a case was forgotten in a switch statement. |
| public String | Returns: a string representation of thisAffine object.Overrides java. Returns a string representation of this |
| public Point2D | transform(double x, double y)
Overrides javafx. Transforms the specified point by this transform. |
| public Point3D | transform(double x, double y, double z)
Overrides javafx. Transforms the specified point by this transform. |
| pack-priv void | transform2DPointsImpl(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Overrides javafx. Core of the transform2DPoints method. |
| pack-priv void | transform3DPointsImpl(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Overrides javafx. Core of the transform3DPoints method. |
| private void | |
| private void | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| private void | updateState()
Manually recalculates the state of the transform when the matrix changes too much to predict the effects on the state. |
| private void |