public class Affine extends Transform
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 ]
Type | Property and Description |
---|---|
DoubleProperty |
mxx
Defines the X coordinate scaling element of the 3x4 matrix.
|
DoubleProperty |
mxy
Defines the XY coordinate element of the 3x4 matrix.
|
DoubleProperty |
mxz
Defines the XZ coordinate element of the 3x4 matrix.
|
DoubleProperty |
myx
Defines the YX coordinate element of the 3x4 matrix.
|
DoubleProperty |
myy
Defines the Y coordinate scaling element of the 3x4 matrix.
|
DoubleProperty |
myz
Defines the YZ coordinate element of the 3x4 matrix.
|
DoubleProperty |
mzx
Defines the ZX coordinate element of the 3x4 matrix.
|
DoubleProperty |
mzy
Defines the ZY coordinate element of the 3x4 matrix.
|
DoubleProperty |
mzz
Defines the Z coordinate scaling element of the 3x4 matrix.
|
DoubleProperty |
tx
Defines the X coordinate translation element of the 3x4 matrix.
|
DoubleProperty |
ty
Defines the Y coordinate translation element of the 3x4 matrix.
|
DoubleProperty |
tz
Defines the Z coordinate translation element of the 3x4 matrix.
|
identityProperty, onTransformChangedProperty, type2DProperty
Modifier and Type | Class and Description |
---|---|
private class |
Affine.AffineAtomicChange
Keeps track of the atomic changes of more elements.
|
private class |
Affine.AffineElementProperty
Affine element property which handles the atomic changes of more
properties.
|
Transform.ImmutableTransform
Modifier and Type | Field and Description |
---|---|
private static 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 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 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 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 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 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.
|
(package private) Affine.AffineAtomicChange |
atomicChange
Tracks atomic changes of more elements.
|
private Affine.AffineElementProperty |
mxx
Defines the X coordinate scaling element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
mxy
Defines the XY coordinate element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
mxz
Defines the XZ coordinate element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
myx
Defines the YX coordinate element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
myy
Defines the Y coordinate scaling element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
myz
Defines the YZ coordinate element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
mzx
Defines the ZX coordinate element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
mzy
Defines the ZY coordinate element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
mzz
Defines the Z coordinate scaling element of the 3x4 matrix.
|
private static int[] |
rot90conversion
Table of 2D state changes during predictable quadrant rotations where
the shear and scaleAffine values are swapped and negated.
|
private 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 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.AffineElementProperty |
tx
Defines the X coordinate translation element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
ty
Defines the Y coordinate translation element of the 3x4 matrix.
|
private Affine.AffineElementProperty |
tz
Defines the Z coordinate translation element of the 3x4 matrix.
|
private double |
xt |
private double |
xx |
private double |
xy |
private double |
xz |
private double |
yt |
private double |
yx |
private double |
yy |
private double |
yz |
private double |
zt |
private double |
zx |
private double |
zy |
private double |
zz |
Constructor and Description |
---|
Affine()
Creates a new instance of
Affine containing an identity transform. |
Affine(double[] matrix,
MatrixType type,
int offset)
Creates a new instance of
Affine with a transformation matrix
specified by an array. |
Affine(double mxx,
double mxy,
double tx,
double myx,
double myy,
double ty)
Creates a new instance of
Affine with a 2D transform specified
by the element values. |
Affine(double mxx,
double mxy,
double mxz,
double tx,
double myx,
double myy,
double myz,
double ty,
double mzx,
double mzy,
double mzz,
double tz)
Creates a new instance of
Affine with a transform specified
by the element values. |
Affine(Transform transform)
Creates a new instance of
Affine filled with the values from
the specified transform. |
Modifier and Type | Method and Description |
---|---|
void |
append(double[] matrix,
MatrixType type,
int offset)
Appends the transform specified by the array to this instance.
|
void |
append(double mxx,
double mxy,
double tx,
double myx,
double myy,
double ty)
Appends the 2D transform specified by the element values to this instance.
|
void |
append(double mxx,
double mxy,
double mxz,
double tx,
double myx,
double myy,
double myz,
double ty,
double mzx,
double mzy,
double mzz,
double tz)
Appends the transform specified by the element values to this instance.
|
void |
append(Transform transform)
Appends the specified transform to this instance.
|
void |
appendRotation(double angle)
Appends the 2D rotation to this instance.
|
void |
appendRotation(double angle,
double pivotX,
double pivotY)
Appends the 2D rotation with pivot to this instance.
|
void |
appendRotation(double angle,
double pivotX,
double pivotY,
double pivotZ,
double axisX,
double axisY,
double axisZ)
Appends the rotation to this instance.
|
void |
appendRotation(double angle,
double pivotX,
double pivotY,
double pivotZ,
Point3D axis)
Appends the rotation to this instance.
|
void |
appendRotation(double angle,
Point2D pivot)
Appends the 2D rotation with pivot to this instance.
|
void |
appendRotation(double angle,
Point3D pivot,
Point3D axis)
Appends the rotation to this instance.
|
void |
appendScale(double sx,
double sy)
Appends the 2D scale to this instance.
|
void |
appendScale(double sx,
double sy,
double pivotX,
double pivotY)
Appends the 2D scale with pivot to this instance.
|
void |
appendScale(double sx,
double sy,
double sz,
double pivotX,
double pivotY,
double pivotZ)
Appends the scale with pivot to this instance.
|
void |
appendScale(double sx,
double sy,
double sz,
Point3D pivot)
Appends the scale with pivot to this instance.
|
void |
appendScale(double sx,
double sy,
Point2D pivot)
Appends the 2D scale with pivot to this instance.
|
void |
appendShear(double shx,
double shy)
Appends the shear to this instance.
|
void |
appendShear(double shx,
double shy,
double pivotX,
double pivotY)
Appends the shear with pivot to this instance.
|
void |
appendShear(double shx,
double shy,
Point2D pivot)
Appends the shear with pivot to this instance.
|
(package private) void |
appendTo(Affine a)
Visitor from
Affine class which provides an efficient
append operation for the subclasses. |
void |
appendTranslation(double tx,
double ty)
Appends the 2D translation to this instance.
|
void |
appendTranslation(double tx,
double ty,
double tz)
Appends the translation to this instance.
|
(package private) void |
apply(Affine3D trans) |
(package private) boolean |
atomicChangeRuns()
Used only by tests to check the atomic operation state
|
Affine |
clone()
Returns a deep copy of this transform.
|
(package private) boolean |
computeIs2D()
Computes if this transform is currently a 2D transform (has no effect
in the direction of Z axis).
|
(package private) boolean |
computeIsIdentity()
Computes if this transform is currently an identity (has
no effect in any direction).
|
Transform |
createConcatenation(Transform transform)
Returns the concatenation of this transform and the specified transform.
|
Affine |
createInverse()
Returns the inverse transform of this transform.
|
Point2D |
deltaTransform(double x,
double y)
Transforms the relative magnitude vector by this transform.
|
Point3D |
deltaTransform(double x,
double y,
double z)
Transforms the relative magnitude vector by this transform.
|
(package private) BaseTransform |
derive(BaseTransform trans) |
double |
determinant()
Computes determinant of the transformation matrix.
|
private double |
getDeterminant2D()
2D implementation of
determinant() . |
private double |
getDeterminant3D()
3D implementation of
determinant() . |
double |
getMxx()
Gets the value of the property mxx.
|
double |
getMxy()
Gets the value of the property mxy.
|
double |
getMxz()
Gets the value of the property mxz.
|
double |
getMyx()
Gets the value of the property myx.
|
double |
getMyy()
Gets the value of the property myy.
|
double |
getMyz()
Gets the value of the property myz.
|
double |
getMzx()
Gets the value of the property mzx.
|
double |
getMzy()
Gets the value of the property mzy.
|
double |
getMzz()
Gets the value of the property mzz.
|
(package private) int |
getState2d()
Used only by tests to check the 2d matrix state
|
(package private) int |
getState3d()
Used only by tests to check the 3d matrix state
|
double |
getTx()
Gets the value of the property tx.
|
double |
getTy()
Gets the value of the property ty.
|
double |
getTz()
Gets the value of the property tz.
|
Point2D |
inverseDeltaTransform(double x,
double y)
Transforms the relative magnitude vector by the inverse of this transform.
|
Point3D |
inverseDeltaTransform(double x,
double y,
double z)
Transforms the relative magnitude vector by the inverse of this transform.
|
Point2D |
inverseTransform(double x,
double y)
Transforms the specified point by the inverse of this transform.
|
Point3D |
inverseTransform(double x,
double y,
double z)
Transforms the specified point by the inverse of this transform.
|
(package private) void |
inverseTransform2DPointsImpl(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Core of the inverseTransform2DPoints method.
|
(package private) void |
inverseTransform3DPointsImpl(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Core of the inverseTransform3DPoints method.
|
void |
invert()
Inverts this transform in place.
|
private void |
invert2D()
2D implementation of
invert() . |
private void |
invert3D()
3D implementation of
invert() . |
DoubleProperty |
mxxProperty()
Defines the X coordinate scaling element of the 3x4 matrix.
|
DoubleProperty |
mxyProperty()
Defines the XY coordinate element of the 3x4 matrix.
|
DoubleProperty |
mxzProperty()
Defines the XZ coordinate element of the 3x4 matrix.
|
DoubleProperty |
myxProperty()
Defines the YX coordinate element of the 3x4 matrix.
|
DoubleProperty |
myyProperty()
Defines the Y coordinate scaling element of the 3x4 matrix.
|
DoubleProperty |
myzProperty()
Defines the YZ coordinate element of the 3x4 matrix.
|
DoubleProperty |
mzxProperty()
Defines the ZX coordinate element of the 3x4 matrix.
|
DoubleProperty |
mzyProperty()
Defines the ZY coordinate element of the 3x4 matrix.
|
DoubleProperty |
mzzProperty()
Defines the Z coordinate scaling element of the 3x4 matrix.
|
private void |
postProcessChange()
Called by each element property after value change to
update the state variables and call transform change notifications.
|
void |
prepend(double[] matrix,
MatrixType type,
int offset)
Prepends the transform specified by the array to this instance.
|
void |
prepend(double mxx,
double mxy,
double tx,
double myx,
double myy,
double ty)
Prepends the 2D transform specified by the element values to this instance.
|
void |
prepend(double mxx,
double mxy,
double mxz,
double tx,
double myx,
double myy,
double myz,
double ty,
double mzx,
double mzy,
double mzz,
double tz)
Prepends the transform specified by the element values to this instance.
|
void |
prepend(Transform transform)
Prepends the specified transform to this instance.
|
void |
prependRotation(double angle)
Prepends the 2D rotation to this instance.
|
void |
prependRotation(double angle,
double pivotX,
double pivotY)
Prepends the 2D rotation with pivot to this instance.
|
void |
prependRotation(double angle,
double pivotX,
double pivotY,
double pivotZ,
double axisX,
double axisY,
double axisZ)
Prepends the rotation to this instance.
|
void |
prependRotation(double angle,
double pivotX,
double pivotY,
double pivotZ,
Point3D axis)
Prepends the rotation to this instance.
|
void |
prependRotation(double angle,
Point2D pivot)
Prepends the 2D rotation with pivot to this instance.
|
void |
prependRotation(double angle,
Point3D pivot,
Point3D axis)
Prepends the rotation to this instance.
|
void |
prependScale(double sx,
double sy)
Prepends the 2D scale to this instance.
|
void |
prependScale(double sx,
double sy,
double pivotX,
double pivotY)
Prepends the 2D scale with pivot to this instance.
|
void |
prependScale(double sx,
double sy,
double sz,
double pivotX,
double pivotY,
double pivotZ)
Prepends the scale with pivot to this instance.
|
void |
prependScale(double sx,
double sy,
double sz,
Point3D pivot)
Prepends the scale with pivot to this instance.
|
void |
prependScale(double sx,
double sy,
Point2D pivot)
Prepends the 2D scale with pivot to this instance.
|
void |
prependShear(double shx,
double shy)
Prepends the shear to this instance.
|
void |
prependShear(double shx,
double shy,
double pivotX,
double pivotY)
Prepends the shear with pivot to this instance.
|
void |
prependShear(double shx,
double shy,
Point2D pivot)
Prepends the shear with pivot to this instance.
|
(package private) void |
prependTo(Affine a)
Visitor from
Affine class which provides an efficient
prepend operation for the subclasses. |
void |
prependTranslation(double tx,
double ty)
Prepends the 2D translation to this instance.
|
void |
prependTranslation(double tx,
double ty,
double tz)
Prepends the translation to this instance.
|
private void |
preRotate2D_180()
2D implementation of
prependRotation for 180 degrees rotation
around Z axis. |
private void |
preRotate2D_270()
2D implementation of
prependRotation for 270 degrees rotation
around Z axis. |
private void |
preRotate2D_90()
2D implementation of
prependRotation for 90 degrees rotation
around Z axis. |
private void |
preRotate2D(double theta)
2D implementation of
prependRotation . |
private void |
preRotate3D_180()
3D implementation of
prependRotation for 180 degrees rotation
around Z axis. |
private void |
preRotate3D_270()
3D implementation of
prependRotation for 270 degrees rotation
around Z axis. |
private void |
preRotate3D_90()
3D implementation of
prependRotation for 90 degrees rotation
around Z axis. |
private void |
preRotate3D(double theta)
3D implementation of
prependRotation around Z axis. |
private void |
preRotate3D(double angle,
double axisX,
double axisY,
double axisZ)
Implementation of the
prependRotation() around an arbitrary axis. |
private void |
preScale2D(double sx,
double sy)
2D implementation of
prependScale() . |
private void |
preScale3D(double sx,
double sy,
double sz)
3D implementation of
prependScale() . |
private void |
preShear2D(double shx,
double shy)
2D implementation of
prependShear() . |
private void |
preShear3D(double shx,
double shy)
3D implementation of
prependShear() . |
private void |
preTranslate2D(double tx,
double ty)
2D implementation of
prependTranslation() . |
private void |
preTranslate3D(double tx,
double ty,
double tz)
3D implementation of
prependTranslation() . |
private void |
rotate2D_180()
2D implementation of
appendRotation for 180 degrees rotation
around Z axis. |
private void |
rotate2D_270()
2D implementation of
appendRotation for 270 degrees rotation
around Z axis. |
private void |
rotate2D_90()
2D implementation of
appendRotation for 90 degrees rotation
around Z axis. |
private void |
rotate2D(double theta)
2D implementation of
appendRotation . |
private void |
rotate3D_180()
3D implementation of
appendRotation for 180 degrees rotation
around Z axis. |
private void |
rotate3D_270()
3D implementation of
appendRotation for 270 degrees rotation
around Z axis. |
private void |
rotate3D_90()
3D implementation of
appendRotation for 90 degrees rotation
around Z axis. |
private void |
rotate3D(double theta)
3D implementation of
appendRotation around Z axis. |
private void |
rotate3D(double angle,
double axisX,
double axisY,
double axisZ)
Implementation of the
appendRotation() around an arbitrary axis. |
private void |
scale2D(double sx,
double sy)
2D implementation of
appendScale() . |
private void |
scale3D(double sx,
double sy,
double sz)
3D implementation of
appendScale() . |
void |
setElement(MatrixType type,
int row,
int column,
double value)
Sets the specified element of the transformation matrix.
|
void |
setMxx(double value)
Sets the value of the property mxx.
|
void |
setMxy(double value)
Sets the value of the property mxy.
|
void |
setMxz(double value)
Sets the value of the property mxz.
|
void |
setMyx(double value)
Sets the value of the property myx.
|
void |
setMyy(double value)
Sets the value of the property myy.
|
void |
setMyz(double value)
Sets the value of the property myz.
|
void |
setMzx(double value)
Sets the value of the property mzx.
|
void |
setMzy(double value)
Sets the value of the property mzy.
|
void |
setMzz(double value)
Sets the value of the property mzz.
|
void |
setToIdentity()
Resets this transform to the identity transform.
|
void |
setToTransform(double[] matrix,
MatrixType type,
int offset)
Sets the values of this instance to the transformation matrix
specified by an array.
|
void |
setToTransform(double mxx,
double mxy,
double tx,
double myx,
double myy,
double ty)
Sets the values of this instance to the 2D transform specified
by the element values.
|
void |
setToTransform(double mxx,
double mxy,
double mxz,
double tx,
double myx,
double myy,
double myz,
double ty,
double mzx,
double mzy,
double mzz,
double tz)
Sets the values of this instance to the transform specified
by the element values.
|
void |
setToTransform(Transform transform)
Sets the values of this instance to the values provided by the specified
transform.
|
void |
setTx(double value)
Sets the value of the property tx.
|
void |
setTy(double value)
Sets the value of the property ty.
|
void |
setTz(double value)
Sets the value of the property tz.
|
private void |
shear2D(double shx,
double shy)
2D implementation of
appendShear() . |
private void |
shear3D(double shx,
double shy)
3D implementation of
appendShear() . |
private static void |
stateError()
Convenience method used internally to throw exceptions when
a case was forgotten in a switch statement.
|
java.lang.String |
toString()
Returns a string representation of this
Affine object. |
Point2D |
transform(double x,
double y)
Transforms the specified point by this transform.
|
Point3D |
transform(double x,
double y,
double z)
Transforms the specified point by this transform.
|
(package private) void |
transform2DPointsImpl(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Core of the transform2DPoints method.
|
(package private) void |
transform3DPointsImpl(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Core of the transform3DPoints method.
|
private void |
translate2D(double tx,
double ty)
2D implementation of
appendTranslation() . |
private void |
translate3D(double tx,
double ty,
double tz)
3D implementation of
appendTranslation() . |
DoubleProperty |
txProperty()
Defines the X coordinate translation element of the 3x4 matrix.
|
DoubleProperty |
tyProperty()
Defines the Y coordinate translation element of the 3x4 matrix.
|
DoubleProperty |
tzProperty()
Defines the Z coordinate translation element of the 3x4 matrix.
|
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 |
updateState2D()
2D part of
updateState() . |
add, addEventFilter, addEventHandler, affine, affine, buildEventDispatchChain, checkRequestedMAT, clearInverseCache, column, column, createImmutableTransform, createImmutableTransform, createImmutableTransform, createImmutableTransform, deltaTransform, deltaTransform, ensureCanTransform2DPoint, fill2DArray, fill3DArray, getElement, getOnTransformChanged, identityProperty, inverseDeltaTransform, inverseDeltaTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform2DPoints, inverseTransform3DPoints, isIdentity, isType2D, onTransformChangedProperty, remove, removeEventFilter, removeEventHandler, rotate, row, row, scale, scale, setOnTransformChanged, shear, shear, similarTo, toArray, toArray, transform, transform, transform, transform2DPoints, transform3DPoints, transformChanged, translate, type2DProperty, validate
public final DoubleProperty mxxProperty
getMxx()
,
setMxx(double)
public final DoubleProperty mxyProperty
getMxy()
,
setMxy(double)
public final DoubleProperty mxzProperty
getMxz()
,
setMxz(double)
public final DoubleProperty txProperty
getTx()
,
setTx(double)
public final DoubleProperty myxProperty
getMyx()
,
setMyx(double)
public final DoubleProperty myyProperty
getMyy()
,
setMyy(double)
public final DoubleProperty myzProperty
getMyz()
,
setMyz(double)
public final DoubleProperty tyProperty
getTy()
,
setTy(double)
public final DoubleProperty mzxProperty
getMzx()
,
setMzx(double)
public final DoubleProperty mzyProperty
getMzy()
,
setMzy(double)
public final DoubleProperty mzzProperty
getMzz()
,
setMzz(double)
public final DoubleProperty tzProperty
getTz()
,
setTz(double)
Affine.AffineAtomicChange atomicChange
private static final int APPLY_IDENTITY
state2d
,
Constant Field Valuesprivate static final int APPLY_TRANSLATE
state2d
,
state3d
,
Constant Field Valuesprivate static final int APPLY_SCALE
state2d
,
state3d
,
Constant Field Valuesprivate static final int APPLY_SHEAR
state2d
,
Constant Field Valuesprivate static final int APPLY_NON_3D
private static final int APPLY_3D_COMPLEX
private transient int state2d
APPLY_IDENTITY
,
APPLY_TRANSLATE
,
APPLY_SCALE
,
APPLY_SHEAR
,
state3d
,
updateState()
private transient int state3d
APPLY_NON_3D
,
APPLY_TRANSLATE
,
APPLY_SCALE
,
APPLY_3D_COMPLEX
,
state2d
,
updateState()
private double xx
private double xy
private double xz
private double yx
private double yy
private double yz
private double zx
private double zy
private double zz
private double xt
private double yt
private double zt
private Affine.AffineElementProperty mxx
private Affine.AffineElementProperty mxy
private Affine.AffineElementProperty mxz
private Affine.AffineElementProperty tx
private Affine.AffineElementProperty myx
private Affine.AffineElementProperty myy
private Affine.AffineElementProperty myz
private Affine.AffineElementProperty ty
private Affine.AffineElementProperty mzx
private Affine.AffineElementProperty mzy
private Affine.AffineElementProperty mzz
private Affine.AffineElementProperty tz
private static final int[] rot90conversion
public Affine()
Affine
containing an identity transform.public Affine(Transform transform)
Affine
filled with the values from
the specified transform.transform
- transform whose matrix is to be filled to the new
instancejava.lang.NullPointerException
- if the specified transform
is nullpublic Affine(double mxx, double mxy, double tx, double myx, double myy, double ty)
Affine
with a 2D transform specified
by the element values.mxx
- the X coordinate scaling elementmxy
- the XY coordinate elementtx
- the X coordinate translation elementmyx
- the YX coordinate elementmyy
- the Y coordinate scaling elementty
- the Y coordinate translation elementpublic Affine(double mxx, double mxy, double mxz, double tx, double myx, double myy, double myz, double ty, double mzx, double mzy, double mzz, double tz)
Affine
with a transform specified
by the element values.mxx
- the X coordinate scaling elementmxy
- the XY coordinate elementmxz
- the XZ coordinate elementtx
- the X coordinate translation elementmyx
- the YX coordinate elementmyy
- the Y coordinate scaling elementmyz
- the YZ coordinate elementty
- the Y coordinate translation elementmzx
- the ZX coordinate elementmzy
- the ZY coordinate elementmzz
- the Z coordinate scaling elementtz
- the Z coordinate translation elementpublic Affine(double[] matrix, MatrixType type, int offset)
Affine
with a transformation matrix
specified by an array.matrix
- array containing the flattened transformation matrixtype
- type of matrix contained in the arrayoffset
- offset of the first element in the arrayjava.lang.IndexOutOfBoundsException
- if the array is too short for
the specified type
and offset
java.lang.IllegalArgumentException
- if the specified matrix is not affine
(the last line of a 2D 3x3 matrix is not [0, 0, 1]
or
the last line of a 3D 4x4 matrix is not [0, 0, 0, 1]
.java.lang.NullPointerException
- if the specified matrix
or type
is nullpublic final void setMxx(double value)
public final double getMxx()
public final DoubleProperty mxxProperty()
getMxx()
,
setMxx(double)
public final void setMxy(double value)
public final double getMxy()
public final DoubleProperty mxyProperty()
getMxy()
,
setMxy(double)
public final void setMxz(double value)
public final double getMxz()
public final DoubleProperty mxzProperty()
getMxz()
,
setMxz(double)
public final void setTx(double value)
public final double getTx()
public final DoubleProperty txProperty()
getTx()
,
setTx(double)
public final void setMyx(double value)
public final double getMyx()
public final DoubleProperty myxProperty()
getMyx()
,
setMyx(double)
public final void setMyy(double value)
public final double getMyy()
public final DoubleProperty myyProperty()
getMyy()
,
setMyy(double)
public final void setMyz(double value)
public final double getMyz()
public final DoubleProperty myzProperty()
getMyz()
,
setMyz(double)
public final void setTy(double value)
public final double getTy()
public final DoubleProperty tyProperty()
getTy()
,
setTy(double)
public final void setMzx(double value)
public final double getMzx()
public final DoubleProperty mzxProperty()
getMzx()
,
setMzx(double)
public final void setMzy(double value)
public final double getMzy()
public final DoubleProperty mzyProperty()
getMzy()
,
setMzy(double)
public final void setMzz(double value)
public final double getMzz()
public final DoubleProperty mzzProperty()
getMzz()
,
setMzz(double)
public final void setTz(double value)
public final double getTz()
public final DoubleProperty tzProperty()
getTz()
,
setTz(double)
public void setElement(MatrixType type, int row, int column, double value)
type
- type of matrix to work withrow
- zero-based row numbercolumn
- zero-based column numbervalue
- new value of the specified transformation matrix elementjava.lang.IndexOutOfBoundsException
- if the indices are not within
the specified matrix typejava.lang.IllegalArgumentException
- if setting the value would break
transform's affinity (for convenience the method allows to set
the elements of the last line of a 2D 3x3 matrix to
[0, 0, 1]
and the elements of the last line
of a 3D 4x4 matrix to [0, 0, 0, 1]
).java.lang.NullPointerException
- if the specified type
is nullprivate void postProcessChange()
boolean computeIs2D()
Transform
computeIs2D
in class Transform
boolean computeIsIdentity()
Transform
computeIsIdentity
in class Transform
public double determinant()
Transform
determinant
in class Transform
private double getDeterminant2D()
determinant()
.
The behavior is undefined if this is a 3D transform.private double getDeterminant3D()
determinant()
.
The behavior is undefined if this is a 2D transform.public Transform createConcatenation(Transform transform)
Transform
getTransforms()
list,
this
transform first and the specified transform
second.createConcatenation
in class Transform
transform
- transform to be concatenated with this transformpublic Affine createInverse() throws NonInvertibleTransformException
Transform
createInverse
in class Transform
NonInvertibleTransformException
- if this transform
cannot be invertedpublic Affine clone()
Transform
public void setToTransform(Transform transform)
transform
- transform whose matrix is to be filled to this instancejava.lang.NullPointerException
- if the specified transform
is nullpublic void setToTransform(double mxx, double mxy, double tx, double myx, double myy, double ty)
mxx
- the X coordinate scaling elementmxy
- the XY coordinate elementtx
- the X coordinate translation elementmyx
- the YX coordinate elementmyy
- the Y coordinate scaling elementty
- the Y coordinate translation elementpublic void setToTransform(double mxx, double mxy, double mxz, double tx, double myx, double myy, double myz, double ty, double mzx, double mzy, double mzz, double tz)
mxx
- the X coordinate scaling elementmxy
- the XY coordinate elementmxz
- the XZ coordinate elementtx
- the X coordinate translation elementmyx
- the YX coordinate elementmyy
- the Y coordinate scaling elementmyz
- the YZ coordinate elementty
- the Y coordinate translation elementmzx
- the ZX coordinate elementmzy
- the ZY coordinate elementmzz
- the Z coordinate scaling elementtz
- the Z coordinate translation elementpublic void setToTransform(double[] matrix, MatrixType type, int offset)
matrix
- array containing the flattened transformation matrixtype
- type of matrix contained in the arrayoffset
- offset of the first element in the arrayjava.lang.IndexOutOfBoundsException
- if the array is too short for
the specified type
and offset
java.lang.IllegalArgumentException
- if the specified matrix is not affine
(the last line of a 2D 3x3 matrix is not [0, 0, 1]
or
the last line of a 3D 4x4 matrix is not [0, 0, 0, 1]
.java.lang.NullPointerException
- if the specified matrix
or type
is nullpublic void setToIdentity()
public void invert() throws NonInvertibleTransformException
NonInvertibleTransformException
- if this transform
cannot be invertedprivate void invert2D() throws NonInvertibleTransformException
invert()
.
The behavior is undefined for a 3D transform.NonInvertibleTransformException
private void invert3D() throws NonInvertibleTransformException
invert()
.
The behavior is undefined if this is a 2D transform.NonInvertibleTransformException
public void append(Transform transform)
Appends the specified transform to this instance.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding the two transforms to its
getTransforms()
list, this
transform first and the specified
transform
second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified transform.
transform
- transform to be appended to this instancejava.lang.NullPointerException
- if the specified transform
is nullpublic void append(double mxx, double mxy, double tx, double myx, double myy, double ty)
Appends the 2D transform specified by the element values to this instance.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding the two transforms to its
getTransforms()
list, this
transform first and the specified
transform
second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified transform.
mxx
- the X coordinate scaling element of the transform to be
appendedmxy
- the XY coordinate element of the transform to be appendedtx
- the X coordinate translation element of the transform to be
appendedmyx
- the YX coordinate element of the transform to be appendedmyy
- the Y coordinate scaling element of the transform to be
appendedty
- the Y coordinate translation element of the transform to be
appendedpublic void append(double mxx, double mxy, double mxz, double tx, double myx, double myy, double myz, double ty, double mzx, double mzy, double mzz, double tz)
Appends the transform specified by the element values to this instance.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding the two transforms to its
getTransforms()
list, this
transform first and the specified
transform
second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified transform.
mxx
- the X coordinate scaling element of the transform to be
appendedmxy
- the XY coordinate element of the transform to be appendedmxz
- the XZ coordinate element of the transform to be appendedtx
- the X coordinate translation element of the transform to be
appendedmyx
- the YX coordinate element of the transform to be appendedmyy
- the Y coordinate scaling element of the transform to be
appendedmyz
- the YZ coordinate element of the transform to be appendedty
- the Y coordinate translation element of the transform to be
appendedmzx
- the ZX coordinate element of the transform to be appendedmzy
- the ZY coordinate element of the transform to be appendedmzz
- the Z coordinate scaling element of the transform to be
appendedtz
- the Z coordinate translation element of the transform to be
appendedpublic void append(double[] matrix, MatrixType type, int offset)
Appends the transform specified by the array to this instance.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding the two transforms to its
getTransforms()
list, this
transform first and the specified
transform
second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified transform.
matrix
- array containing the flattened transformation matrix
to be appendedtype
- type of matrix contained in the arrayoffset
- offset of the first matrix element in the arrayjava.lang.IndexOutOfBoundsException
- if the array is too short for
the specified type
and offset
java.lang.IllegalArgumentException
- if the specified matrix is not affine
(the last line of a 2D 3x3 matrix is not [0, 0, 1]
or
the last line of a 3D 4x4 matrix is not [0, 0, 0, 1]
.java.lang.NullPointerException
- if the specified matrix
or type
is nullvoid appendTo(Affine a)
Transform
Affine
class which provides an efficient
append
operation for the subclasses.public void prepend(Transform transform)
Prepends the specified transform to this instance.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding the two transforms to its
getTransforms()
list, the specified transform
first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified transform.
transform
- transform to be prepended to this instancejava.lang.NullPointerException
- if the specified transform
is nullpublic void prepend(double mxx, double mxy, double tx, double myx, double myy, double ty)
Prepends the 2D transform specified by the element values to this instance.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding the two transforms to its
getTransforms()
list, the specified transform
first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified transform.
mxx
- the X coordinate scaling element of the transform to be
prependedmxy
- the XY coordinate element of the transform to be prependedtx
- the X coordinate translation element of the transform to be
prependedmyx
- the YX coordinate element of the transform to be prependedmyy
- the Y coordinate scaling element of the transform to be
prependedty
- the Y coordinate translation element of the transform to be
prependedpublic void prepend(double mxx, double mxy, double mxz, double tx, double myx, double myy, double myz, double ty, double mzx, double mzy, double mzz, double tz)
Prepends the transform specified by the element values to this instance.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding the two transforms to its
getTransforms()
list, the specified transform
first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified transform.
mxx
- the X coordinate scaling element of the transform to be
prependedmxy
- the XY coordinate element of the transform to be prependedmxz
- the XZ coordinate element of the transform to be prependedtx
- the X coordinate translation element of the transform to be
prependedmyx
- the YX coordinate element of the transform to be prependedmyy
- the Y coordinate scaling element of the transform to be
prependedmyz
- the YZ coordinate element of the transform to be prependedty
- the Y coordinate translation element of the transform to be
prependedmzx
- the ZX coordinate element of the transform to be prependedmzy
- the ZY coordinate element of the transform to be prependedmzz
- the Z coordinate scaling element of the transform to be
prependedtz
- the Z coordinate translation element of the transform to be
prependedpublic void prepend(double[] matrix, MatrixType type, int offset)
Prepends the transform specified by the array to this instance.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding the two transforms to its
getTransforms()
list, the specified transform
first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified transform.
matrix
- array containing the flattened transformation matrix
to be prependedtype
- type of matrix contained in the arrayoffset
- offset of the first matrix element in the arrayjava.lang.IndexOutOfBoundsException
- if the array is too short for
the specified type
and offset
java.lang.IllegalArgumentException
- if the specified matrix is not affine
(the last line of a 2D 3x3 matrix is not [0, 0, 1]
or
the last line of a 3D 4x4 matrix is not [0, 0, 0, 1]
.java.lang.NullPointerException
- if the specified matrix
or type
is nullvoid prependTo(Affine a)
Transform
Affine
class which provides an efficient
prepend
operation for the subclasses.public void appendTranslation(double tx, double ty)
Appends the 2D translation to this instance.
It is equivalent to append(new Translate(tx, ty))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
translation second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified translation.
tx
- the X coordinate translationty
- the Y coordinate translationpublic void appendTranslation(double tx, double ty, double tz)
Appends the translation to this instance.
It is equivalent to append(new Translate(tx, ty, tz))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
translation second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified translation.
tx
- the X coordinate translationty
- the Y coordinate translationtz
- the Z coordinate translationprivate void translate2D(double tx, double ty)
appendTranslation()
.
If this is a 3D transform, the call is redirected to transalte3D()
.private void translate3D(double tx, double ty, double tz)
appendTranslation()
.
Works fine if this is a 2D transform.public void prependTranslation(double tx, double ty, double tz)
Prepends the translation to this instance.
It is equivalent to prepend(new Translate(tx, ty, tz))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified translation first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified translation.
tx
- the X coordinate translationty
- the Y coordinate translationtz
- the Z coordinate translationpublic void prependTranslation(double tx, double ty)
Prepends the 2D translation to this instance.
It is equivalent to prepend(new Translate(tx, ty))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified translation first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified translation.
tx
- the X coordinate translationty
- the Y coordinate translationprivate void preTranslate2D(double tx, double ty)
prependTranslation()
.
If this is a 3D transform, the call is redirected to
preTransalte3D
.private void preTranslate3D(double tx, double ty, double tz)
prependTranslation()
.
Works fine if this is a 2D transform.public void appendScale(double sx, double sy)
Appends the 2D scale to this instance.
It is equivalent to append(new Scale(sx, sy))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
scale second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorpublic void appendScale(double sx, double sy, double pivotX, double pivotY)
Appends the 2D scale with pivot to this instance.
It is equivalent to append(new Scale(sx, sy, pivotX, pivotY))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
scale second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorpivotX
- the X coordinate of the point about which the scale occurspivotY
- the Y coordinate of the point about which the scale occurspublic void appendScale(double sx, double sy, Point2D pivot)
Appends the 2D scale with pivot to this instance.
It is equivalent to
append(new Scale(sx, sy, pivot.getX(), pivot.getY())
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
scale second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorpivot
- the point about which the scale occursjava.lang.NullPointerException
- if the specified pivot
is nullpublic void appendScale(double sx, double sy, double sz, double pivotX, double pivotY, double pivotZ)
Appends the scale with pivot to this instance.
It is equivalent to append(new Scale(sx, sy, sz, pivotX,
pivotY, pivotZ))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
scale second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorsz
- the Z coordinate scale factorpivotX
- the X coordinate of the point about which the scale occurspivotY
- the Y coordinate of the point about which the scale occurspivotZ
- the Z coordinate of the point about which the scale occurspublic void appendScale(double sx, double sy, double sz, Point3D pivot)
Appends the scale with pivot to this instance.
It is equivalent to append(new Scale(sx, sy, sz, pivot.getX(),
pivot.getY(), pivot.getZ()))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
scale second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorsz
- the Z coordinate scale factorpivot
- the point about which the scale occursjava.lang.NullPointerException
- if the specified pivot
is nullprivate void scale2D(double sx, double sy)
appendScale()
.
If this is a 3D transform, the call is redirected to scale3D()
.private void scale3D(double sx, double sy, double sz)
appendScale()
.
Works fine if this is a 2D transform.public void prependScale(double sx, double sy)
Prepends the 2D scale to this instance.
It is equivalent to prepend(new Scale(sx, sy))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified scale first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorpublic void prependScale(double sx, double sy, double pivotX, double pivotY)
Prepends the 2D scale with pivot to this instance.
It is equivalent to prepend(new Scale(sx, sy, pivotX, pivotY))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified scale first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorpivotX
- the X coordinate of the point about which the scale occurspivotY
- the Y coordinate of the point about which the scale occurspublic void prependScale(double sx, double sy, Point2D pivot)
Prepends the 2D scale with pivot to this instance.
It is equivalent to prepend(new Scale(sx, sy, pivot.getX(),
</p>pivot.getY()))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified scale first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorpivot
- the point about which the scale occursjava.lang.NullPointerException
- if the specified pivot
is nullpublic void prependScale(double sx, double sy, double sz, double pivotX, double pivotY, double pivotZ)
Prepends the scale with pivot to this instance.
It is equivalent to
prepend(new Scale(sx, sy, sz, pivotX, pivotY, pivotZ))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified scale first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorsz
- the Z coordinate scale factorpivotX
- the X coordinate of the point about which the scale occurspivotY
- the Y coordinate of the point about which the scale occurspivotZ
- the Z coordinate of the point about which the scale occurspublic void prependScale(double sx, double sy, double sz, Point3D pivot)
Prepends the scale with pivot to this instance.
It is equivalent to prepend(new Scale(sx, sy, sz, pivot.getX(),
pivot.getY(), pivot.getZ()))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified scale first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified scale.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorsz
- the Z coordinate scale factorpivot
- the point about which the scale occursjava.lang.NullPointerException
- if the specified pivot
is nullprivate void preScale2D(double sx, double sy)
prependScale()
.
If this is a 3D transform, the call is redirected to preScale3D()
.private void preScale3D(double sx, double sy, double sz)
prependScale()
.
Works fine if this is a 2D transform.public void appendShear(double shx, double shy)
Appends the shear to this instance.
It is equivalent to append(new Shear(sx, sy))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
shear second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified shear.
shx
- the XY coordinate elementshy
- the YX coordinate elementpublic void appendShear(double shx, double shy, double pivotX, double pivotY)
Appends the shear with pivot to this instance.
It is equivalent to append(new Shear(sx, sy, pivotX, pivotY))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
shear second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified shear.
shx
- the XY coordinate elementshy
- the YX coordinate elementpivotX
- the X coordinate of the shear pivot pointpivotY
- the Y coordinate of the shear pivot pointpublic void appendShear(double shx, double shy, Point2D pivot)
Appends the shear with pivot to this instance.
It is equivalent to append(new Shear(sx, sy,
pivot.getX(), pivot.getY()))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
shear second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified shear.
shx
- the XY coordinate elementshy
- the YX coordinate elementpivot
- the shear pivot pointjava.lang.NullPointerException
- if the specified pivot
is nullprivate void shear2D(double shx, double shy)
appendShear()
.
If this is a 3D transform, the call is redirected to shear3D()
.private void shear3D(double shx, double shy)
appendShear()
.
Works fine if this is a 2D transform.public void prependShear(double shx, double shy)
Prepends the shear to this instance.
It is equivalent to prepend(new Shear(sx, sy))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified shear first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified shear.
shx
- the XY coordinate elementshy
- the YX coordinate elementpublic void prependShear(double shx, double shy, double pivotX, double pivotY)
Prepends the shear with pivot to this instance.
It is equivalent to prepend(new Shear(sx, sy, pivotX, pivotY))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified shear first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified shear.
shx
- the XY coordinate elementshy
- the YX coordinate elementpivotX
- the X coordinate of the shear pivot pointpivotY
- the Y coordinate of the shear pivot pointpublic void prependShear(double shx, double shy, Point2D pivot)
Prepends the shear with pivot to this instance.
It is equivalent to prepend(new Shear(sx, sy, pivot.getX(),
pivot.getY()))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified shear first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified shear.
shx
- the XY coordinate elementshy
- the YX coordinate elementpivot
- the shear pivot pointjava.lang.NullPointerException
- if the specified pivot
is nullprivate void preShear2D(double shx, double shy)
prependShear()
.
If this is a 3D transform, the call is redirected to preShear3D()
.private void preShear3D(double shx, double shy)
prependShear()
.
Works fine if this is a 2D transform.public void appendRotation(double angle)
Appends the 2D rotation to this instance.
It is equivalent to append(new Rotate(angle))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
rotation second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespublic void appendRotation(double angle, double pivotX, double pivotY)
Appends the 2D rotation with pivot to this instance.
It is equivalent to append(new Rotate(angle, pivotX, pivotY))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
rotation second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivotX
- the X coordinate of the rotation pivot pointpivotY
- the Y coordinate of the rotation pivot pointpublic void appendRotation(double angle, Point2D pivot)
Appends the 2D rotation with pivot to this instance.
It is equivalent to append(new Rotate(angle, pivot.getX(),
pivot.getY()))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
rotation second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivot
- the rotation pivot pointjava.lang.NullPointerException
- if the specified pivot
is nullpublic void appendRotation(double angle, double pivotX, double pivotY, double pivotZ, double axisX, double axisY, double axisZ)
Appends the rotation to this instance.
It is equivalent to append(new Rotate(angle, pivotX, pivotY,
pivotZ, new Point3D(axisX, axisY, axisZ)))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
rotation second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivotX
- the X coordinate of the rotation pivot pointpivotY
- the Y coordinate of the rotation pivot pointpivotZ
- the Z coordinate of the rotation pivot pointaxisX
- the X coordinate magnitude of the rotation axisaxisY
- the Y coordinate magnitude of the rotation axisaxisZ
- the Z coordinate magnitude of the rotation axispublic void appendRotation(double angle, double pivotX, double pivotY, double pivotZ, Point3D axis)
Appends the rotation to this instance.
It is equivalent to append(new Rotate(angle, pivotX, pivotY,
pivotZ, axis))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
rotation second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivotX
- the X coordinate of the rotation pivot pointpivotY
- the Y coordinate of the rotation pivot pointpivotZ
- the Z coordinate of the rotation pivot pointaxis
- the rotation axisjava.lang.NullPointerException
- if the specified axis
is nullpublic void appendRotation(double angle, Point3D pivot, Point3D axis)
Appends the rotation to this instance.
It is equivalent to append(new Rotate(angle, pivot.getX(),
pivot.getY(), pivot.getZ(), axis))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, this
transform first and the specified
rotation second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the right by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivot
- the rotation pivot pointaxis
- the rotation axisjava.lang.NullPointerException
- if the specified pivot
or axis
is nullprivate void rotate3D(double angle, double axisX, double axisY, double axisZ)
appendRotation()
around an arbitrary axis.private void rotate2D(double theta)
appendRotation
.
If this is a 3D transform, the call is redirected to rotate3D()
.private void rotate2D_90()
appendRotation
for 90 degrees rotation
around Z axis.
Behaves wrong when called for a 3D transform.private void rotate2D_180()
appendRotation
for 180 degrees rotation
around Z axis.
Behaves wrong when called for a 3D transform.private void rotate2D_270()
appendRotation
for 270 degrees rotation
around Z axis.
Behaves wrong when called for a 3D transform.private void rotate3D(double theta)
appendRotation
around Z axis.
If this is a 2D transform, the call is redirected to rotate2D()
.private void rotate3D_90()
appendRotation
for 90 degrees rotation
around Z axis.
Behaves wrong when called for a 2D transform.private void rotate3D_180()
appendRotation
for 180 degrees rotation
around Z axis.
Behaves wrong when called for a 2D transform.private void rotate3D_270()
appendRotation
for 270 degrees rotation
around Z axis.
Behaves wrong when called for a 2D transform.public void prependRotation(double angle)
Prepends the 2D rotation to this instance.
It is equivalent to prepend(new Rotate(angle))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified rotation first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespublic void prependRotation(double angle, double pivotX, double pivotY)
Prepends the 2D rotation with pivot to this instance.
It is equivalent to prepend(new Rotate(angle, pivotX, pivotY))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified rotation first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivotX
- the X coordinate of the rotation pivot pointpivotY
- the Y coordinate of the rotation pivot pointpublic void prependRotation(double angle, Point2D pivot)
Prepends the 2D rotation with pivot to this instance.
It is equivalent to prepend(new Rotate(angle, pivot.getX(),
pivot.getY()))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified rotation first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivot
- the rotation pivot pointjava.lang.NullPointerException
- if the specified pivot
is nullpublic void prependRotation(double angle, double pivotX, double pivotY, double pivotZ, double axisX, double axisY, double axisZ)
Prepends the rotation to this instance.
It is equivalent to prepend(new Rotate(angle, pivotX, pivotY,
pivotZ, new Point3D(axisX, axisY, axisZ)))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified rotation first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivotX
- the X coordinate of the rotation pivot pointpivotY
- the Y coordinate of the rotation pivot pointpivotZ
- the Z coordinate of the rotation pivot pointaxisX
- the X coordinate magnitude of the rotation axisaxisY
- the Y coordinate magnitude of the rotation axisaxisZ
- the Z coordinate magnitude of the rotation axispublic void prependRotation(double angle, double pivotX, double pivotY, double pivotZ, Point3D axis)
Prepends the rotation to this instance.
It is equivalent to prepend(new Rotate(angle, pivotX, pivotY,
pivotZ, axis))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified rotation first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivotX
- the X coordinate of the rotation pivot pointpivotY
- the Y coordinate of the rotation pivot pointpivotZ
- the Z coordinate of the rotation pivot pointaxis
- the rotation axisjava.lang.NullPointerException
- if the specified axis
is nullpublic void prependRotation(double angle, Point3D pivot, Point3D axis)
Prepends the rotation to this instance.
It is equivalent to prepend(new Rotate(angle, pivot.getX(),
pivot.getY(), pivot.getZ(), axis))
.
The operation modifies this transform in a way that applying it to a node
has the same effect as adding two transforms to its
getTransforms()
list, the specified rotation first
and this
transform second.
From the matrix point of view, the transformation matrix of this transform is multiplied on the left by the transformation matrix of the specified rotation.
angle
- the angle of the rotation in degreespivot
- the rotation pivot pointaxis
- the rotation axisjava.lang.NullPointerException
- if the specified pivot
or axis
is nullprivate void preRotate3D(double angle, double axisX, double axisY, double axisZ)
prependRotation()
around an arbitrary axis.private void preRotate2D(double theta)
prependRotation
.
If this is a 3D transform, the call is redirected to preRotate3D()
.private void preRotate2D_90()
prependRotation
for 90 degrees rotation
around Z axis.
Behaves wrong when called for a 3D transform.private void preRotate2D_180()
prependRotation
for 180 degrees rotation
around Z axis.
Behaves wrong when called for a 3D transform.private void preRotate2D_270()
prependRotation
for 270 degrees rotation
around Z axis.
Behaves wrong when called for a 3D transform.private void preRotate3D(double theta)
prependRotation
around Z axis.
If this is a 2D transform, the call is redirected to preRotate2D()
.private void preRotate3D_90()
prependRotation
for 90 degrees rotation
around Z axis.
Behaves wrong when called for a 2D transform.private void preRotate3D_180()
prependRotation
for 180 degrees rotation
around Z axis.
Behaves wrong when called for a 2D transform.private void preRotate3D_270()
prependRotation
for 270 degrees rotation
around Z axis.
Behaves wrong when called for a 2D transform.public Point2D transform(double x, double y)
Transform
public Point3D transform(double x, double y, double z)
Transform
void transform2DPointsImpl(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Transform
transform2DPointsImpl
in class Transform
void transform3DPointsImpl(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
Transform
transform3DPointsImpl
in class Transform
public Point2D deltaTransform(double x, double y)
Transform
deltaTransform
in class Transform
x
- vector magnitude in the direction of the X axisy
- vector magnitude in the direction of the Y axisPoint2D
instancepublic Point3D deltaTransform(double x, double y, double z)
Transform
deltaTransform
in class Transform
x
- vector magnitude in the direction of the X axisy
- vector magnitude in the direction of the Y axisz
- vector magnitude in the direction of the Z axisPoint3D
instancepublic Point2D inverseTransform(double x, double y) throws NonInvertibleTransformException
Transform
inverseTransform
in class Transform
x
- the X coordinate of the pointy
- the Y coordinate of the pointNonInvertibleTransformException
- if this transform
cannot be invertedpublic Point3D inverseTransform(double x, double y, double z) throws NonInvertibleTransformException
Transform
inverseTransform
in class Transform
x
- the X coordinate of the pointy
- the Y coordinate of the pointz
- the Z coordinate of the pointNonInvertibleTransformException
- if this transform
cannot be invertedvoid inverseTransform2DPointsImpl(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws NonInvertibleTransformException
Transform
inverseTransform2DPointsImpl
in class Transform
NonInvertibleTransformException
void inverseTransform3DPointsImpl(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws NonInvertibleTransformException
Transform
inverseTransform3DPointsImpl
in class Transform
NonInvertibleTransformException
public Point2D inverseDeltaTransform(double x, double y) throws NonInvertibleTransformException
Transform
inverseDeltaTransform
in class Transform
x
- vector magnitude in the direction of the X axisy
- vector magnitude in the direction of the Y axisPoint2D
instanceNonInvertibleTransformException
- if this transform
cannot be invertedpublic Point3D inverseDeltaTransform(double x, double y, double z) throws NonInvertibleTransformException
Transform
inverseDeltaTransform
in class Transform
x
- vector magnitude in the direction of the X axisy
- vector magnitude in the direction of the Y axisz
- vector magnitude in the direction of the Z axisPoint3D
instanceNonInvertibleTransformException
- if this transform
cannot be invertedpublic java.lang.String toString()
Affine
object.toString
in class java.lang.Object
Affine
object.private void updateState()
SCALE TRANSLATE OTHER ELEMENTS mxx, myy, mzz tx, ty, tz all remaining TRANSLATE (TR) 1.0 not all 0.0 0.0 SCALE (SC) not all 1.0 0.0 0.0 TR | SC not all 1.0 not all 0.0 0.0 3D_COMPLEX any any not all 0.0 NON_3D: mxz, myz, mzx, mzy, tz are 0.0, mzz is 1.0, for the rest see state2d
SCALE SHEAR TRANSLATE mxx/myy mxy/myx tx/ty IDENTITY 1.0 0.0 0.0 TRANSLATE (TR) 1.0 0.0 not both 0.0 SCALE (SC) not both 1.0 0.0 0.0 TR | SC not both 1.0 0.0 not both 0.0 SHEAR (SH) 0.0 not both 0.0 0.0 TR | SH 0.0 not both 0.0 not both 0.0 SC | SH not both 0.0 not both 0.0 0.0 TR | SC | SH not both 0.0 not both 0.0 not both 0.0
private void updateState2D()
updateState()
. It is sufficient to call this method
when we know this this a 2D transform and the operation was 2D-only
so it could not switch the transform to 3D.private static void stateError()
int getState2d()
int getState3d()
boolean atomicChangeRuns()