public class Rotate extends Transform
Affine object that rotates coordinates
around an anchor point. This operation is equivalent to translating the
coordinates so that the anchor point is at the origin (S1), then rotating them
about the new origin (S2), and finally translating so that the
intermediate origin is restored to the coordinates of the original
anchor point (S3).
For example, the matrix representing the returned transform of
new Rotate (theta, x, y, z) around the Z-axis
is :
[ cos(theta) -sin(theta) 0 x-x*cos+y*sin ]
[ sin(theta) cos(theta) 0 y-x*sin-y*cos ]
[ 0 0 1 z ]
For example, to rotate a text 30 degrees around the Z-axis at anchor point of (50,30):
Text text = new Text("This is a test");
text.setX(10);
text.setY(50);
text.setFont(new Font(20));
text.getTransforms().add(new Rotate(30, 50, 30));
| Modifier and Type | Class and Description |
|---|---|
private static class |
Rotate.MatrixCache
Matrix cache.
|
| Modifier and Type | Field and Description |
|---|---|
private DoubleProperty |
angle
Defines the angle of rotation measured in degrees.
|
private ObjectProperty<Point3D> |
axis
Defines the axis of rotation at the pivot point.
|
private Rotate.MatrixCache |
cache
Avoids lot of repeated computation.
|
private Rotate.MatrixCache |
inverseCache
Avoids lot of repeated computation.
|
private DoubleProperty |
pivotX
Defines the X coordinate of the rotation pivot point.
|
private DoubleProperty |
pivotY
Defines the Y coordinate of the rotation pivot point.
|
private DoubleProperty |
pivotZ
Defines the Z coordinate of the rotation pivot point.
|
static Point3D |
X_AXIS
Specifies the X-axis as the axis of rotation.
|
static Point3D |
Y_AXIS
Specifies the Y-axis as the axis of rotation.
|
static Point3D |
Z_AXIS
Specifies the Z-axis as the axis of rotation.
|
| Constructor and Description |
|---|
Rotate()
Creates a default Rotate transform (identity).
|
Rotate(double angle)
Creates a two-dimensional Rotate transform.
|
Rotate(double angle,
double pivotX,
double pivotY)
Creates a two-dimensional Rotate transform with pivot.
|
Rotate(double angle,
double pivotX,
double pivotY,
double pivotZ)
Creates a simple Rotate transform with three-dimensional pivot.
|
Rotate(double angle,
double pivotX,
double pivotY,
double pivotZ,
Point3D axis)
Creates a three-dimensional Rotate transform with pivot.
|
Rotate(double angle,
Point3D axis)
Creates a three-dimensional Rotate transform.
|
| Modifier and Type | Method and Description |
|---|---|
DoubleProperty |
angleProperty() |
(package private) void |
appendTo(Affine a)
Visitor from
Affine class which provides an efficient
append operation for the subclasses. |
ObjectProperty<Point3D> |
axisProperty() |
Rotate |
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.
|
Transform |
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) void |
fill2DArray(double[] array)
Core of the toArray implementation for the 2D case.
|
(package private) void |
fill3DArray(double[] array)
Core of the toArray implementation for the 3D case.
|
double |
getAngle() |
Point3D |
getAxis() |
double |
getMxx()
Gets the X coordinate scaling element of the 3x4 matrix.
|
double |
getMxy()
Gets the XY coordinate element of the 3x4 matrix.
|
double |
getMxz()
Gets the XZ coordinate element of the 3x4 matrix.
|
double |
getMyx()
Gets the YX coordinate element of the 3x4 matrix.
|
double |
getMyy()
Gets the Y coordinate scaling element of the 3x4 matrix.
|
double |
getMyz()
Gets the YZ coordinate element of the 3x4 matrix.
|
double |
getMzx()
Gets the ZX coordinate element of the 3x4 matrix.
|
double |
getMzy()
Gets the ZY coordinate element of the 3x4 matrix.
|
double |
getMzz()
Gets the Z coordinate scaling element of the 3x4 matrix.
|
double |
getPivotX() |
double |
getPivotY() |
double |
getPivotZ() |
double |
getTx()
Gets the X coordinate translation element of the 3x4 matrix.
|
double |
getTy()
Gets the Y coordinate translation element of the 3x4 matrix.
|
double |
getTz()
Gets the Z coordinate translation element of the 3x4 matrix.
|
void |
impl_apply(Affine3D trans)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
BaseTransform |
impl_derive(BaseTransform trans)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
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.
|
DoubleProperty |
pivotXProperty() |
DoubleProperty |
pivotYProperty() |
DoubleProperty |
pivotZProperty() |
(package private) void |
prependTo(Affine a)
Visitor from
Affine class which provides an efficient
prepend operation for the subclasses. |
void |
setAngle(double value) |
void |
setAxis(Point3D value) |
void |
setPivotX(double value) |
void |
setPivotY(double value) |
void |
setPivotZ(double value) |
java.lang.String |
toString()
Returns a string representation of this
Rotate 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.
|
protected void |
transformChanged()
This method must be called by all transforms whenever any of their
parameters changes.
|
private void |
updateCache()
Updates the matrix cache
|
private void |
updateInverseCache()
Updates the inverse matrix cache
|
(package private) void |
validate()
Needed for the proper delivery of the TransformChangedEvent.
|
addEventFilter, addEventHandler, affine, affine, buildEventDispatchChain, checkRequestedMAT, clearInverseCache, column, column, deltaTransform, deltaTransform, determinant, ensureCanTransform2DPoint, getElement, getOnTransformChanged, identityProperty, impl_add, impl_remove, inverseDeltaTransform, inverseDeltaTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform2DPoints, inverseTransform3DPoints, isIdentity, isType2D, onTransformChangedProperty, removeEventFilter, removeEventHandler, rotate, row, row, scale, scale, setOnTransformChanged, shear, shear, similarTo, toArray, toArray, transform, transform, transform, transform2DPoints, transform3DPoints, translate, type2DPropertypublic static final Point3D X_AXIS
public static final Point3D Y_AXIS
public static final Point3D Z_AXIS
private Rotate.MatrixCache cache
#MatrixCacheprivate Rotate.MatrixCache inverseCache
#MatrixCacheprivate DoubleProperty angle
private DoubleProperty pivotX
private DoubleProperty pivotY
private DoubleProperty pivotZ
private ObjectProperty<Point3D> axis
public Rotate()
public Rotate(double angle)
angle - the angle of rotation measured in degreespublic Rotate(double angle,
Point3D axis)
angle - the angle of rotation measured in degreesaxis - the axis of rotationpublic Rotate(double angle,
double pivotX,
double pivotY)
angle - the angle of rotation measured in degreespivotX - the X coordinate of the rotation pivot pointpivotY - the Y coordinate of the rotation pivot pointpublic Rotate(double angle,
double pivotX,
double pivotY,
double pivotZ)
angle - the angle of rotation measured 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 pointpublic Rotate(double angle,
double pivotX,
double pivotY,
double pivotZ,
Point3D axis)
angle - the angle of rotation measured 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 axis of rotationpublic final void setAngle(double value)
public final double getAngle()
public final DoubleProperty angleProperty()
public final void setPivotX(double value)
public final double getPivotX()
public final DoubleProperty pivotXProperty()
public final void setPivotY(double value)
public final double getPivotY()
public final DoubleProperty pivotYProperty()
public final void setPivotZ(double value)
public final double getPivotZ()
public final DoubleProperty pivotZProperty()
public final void setAxis(Point3D value)
public final Point3D getAxis()
public final ObjectProperty<Point3D> axisProperty()
public double getMxx()
Transformpublic double getMxy()
Transformpublic double getMxz()
Transformpublic double getTx()
Transformpublic double getMyx()
Transformpublic double getMyy()
Transformpublic double getMyz()
Transformpublic double getTy()
Transformpublic double getMzx()
Transformpublic double getMzy()
Transformpublic double getMzz()
Transformpublic double getTz()
Transformboolean computeIs2D()
TransformcomputeIs2D in class Transformboolean computeIsIdentity()
TransformcomputeIsIdentity in class Transformvoid fill2DArray(double[] array)
Transformfill2DArray in class Transformarray - array to be filled with the 6 2D elementsvoid fill3DArray(double[] array)
Transformfill3DArray in class Transformarray - array to be filled with the 12 3D elementspublic Transform createConcatenation(Transform transform)
TransformgetTransforms() list,
this transform first and the specified transform second.createConcatenation in class Transformtransform - transform to be concatenated with this transformpublic Transform createInverse() throws NonInvertibleTransformException
TransformcreateInverse in class TransformNonInvertibleTransformException - if this transform
cannot be invertedpublic Rotate clone()
Transformpublic Point2D transform(double x, double y)
Transformpublic Point3D transform(double x, double y, double z)
Transformvoid transform2DPointsImpl(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Transformtransform2DPointsImpl in class Transformvoid transform3DPointsImpl(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Transformtransform3DPointsImpl in class Transformpublic Point2D deltaTransform(double x, double y)
TransformdeltaTransform in class Transformx - 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)
TransformdeltaTransform in class Transformx - vector magnitude in the direction of the X axisy - vector magnitude in the direction of the Y axisPoint3D instancepublic Point2D inverseTransform(double x, double y)
TransforminverseTransform in class Transformx - the X coordinate of the pointy - the Y coordinate of the pointpublic Point3D inverseTransform(double x, double y, double z)
TransforminverseTransform in class Transformx - the X coordinate of the pointy - the Y coordinate of the pointz - the Z coordinate of the pointvoid inverseTransform2DPointsImpl(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
TransforminverseTransform2DPointsImpl in class Transformvoid inverseTransform3DPointsImpl(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
TransforminverseTransform3DPointsImpl in class Transformpublic Point2D inverseDeltaTransform(double x, double y)
TransforminverseDeltaTransform in class Transformx - vector magnitude in the direction of the X axisy - vector magnitude in the direction of the Y axisPoint2D instancepublic Point3D inverseDeltaTransform(double x, double y, double z)
TransforminverseDeltaTransform in class Transformx - vector magnitude in the direction of the X axisy - vector magnitude in the direction of the Y axisPoint3D instancepublic java.lang.String toString()
Rotate object.toString in class java.lang.ObjectRotate object.@Deprecated public void impl_apply(Affine3D trans)
impl_apply in class Transform@Deprecated public BaseTransform impl_derive(BaseTransform trans)
impl_derive in class Transformvoid validate()
Transformprotected void transformChanged()
TransformtransformChanged in class Transformvoid appendTo(Affine a)
TransformAffine class which provides an efficient
append operation for the subclasses.void prependTo(Affine a)
TransformAffine class which provides an efficient
prepend operation for the subclasses.private void updateCache()
private void updateInverseCache()