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));
Type | Property and Description |
---|---|
DoubleProperty |
angle
Defines the angle of rotation measured in degrees.
|
ObjectProperty<Point3D> |
axis
Defines the axis of rotation at the pivot point.
|
DoubleProperty |
pivotX
Defines the X coordinate of the rotation pivot point.
|
DoubleProperty |
pivotY
Defines the Y coordinate of the rotation pivot point.
|
DoubleProperty |
pivotZ
Defines the Z coordinate of the rotation pivot point.
|
identity, onTransformChanged, type2D
Modifier and Type | Field and Description |
---|---|
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()
Defines the angle of rotation measured in degrees.
|
ObjectProperty<Point3D> |
axisProperty()
Defines the axis of rotation at the pivot point.
|
Rotate |
clone()
Returns a deep copy of this transform.
|
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.
|
double |
getAngle()
Gets the value of the property angle.
|
Point3D |
getAxis()
Gets the value of the property axis.
|
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()
Gets the value of the property pivotX.
|
double |
getPivotY()
Gets the value of the property pivotY.
|
double |
getPivotZ()
Gets the value of the property pivotZ.
|
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.
|
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.
|
DoubleProperty |
pivotXProperty()
Defines the X coordinate of the rotation pivot point.
|
DoubleProperty |
pivotYProperty()
Defines the Y coordinate of the rotation pivot point.
|
DoubleProperty |
pivotZProperty()
Defines the Z coordinate of the rotation pivot point.
|
void |
setAngle(double value)
Sets the value of the property angle.
|
void |
setAxis(Point3D value)
Sets the value of the property axis.
|
void |
setPivotX(double value)
Sets the value of the property pivotX.
|
void |
setPivotY(double value)
Sets the value of the property pivotY.
|
void |
setPivotZ(double value)
Sets the value of the property pivotZ.
|
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.
|
protected void |
transformChanged()
This method must be called by all transforms whenever any of their
parameters changes.
|
addEventFilter, addEventHandler, affine, affine, buildEventDispatchChain, column, column, deltaTransform, deltaTransform, determinant, getElement, getOnTransformChanged, identityProperty, 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, type2DProperty
public final DoubleProperty angleProperty
getAngle()
,
setAngle(double)
public final DoubleProperty pivotXProperty
getPivotX()
,
setPivotX(double)
public final DoubleProperty pivotYProperty
getPivotY()
,
setPivotY(double)
public final DoubleProperty pivotZProperty
getPivotZ()
,
setPivotZ(double)
public final ObjectProperty<Point3D> axisProperty
getAxis()
,
setAxis(Point3D)
public static final Point3D X_AXIS
public static final Point3D Y_AXIS
public static final Point3D Z_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()
getAngle()
,
setAngle(double)
public final void setPivotX(double value)
public final double getPivotX()
public final DoubleProperty pivotXProperty()
getPivotX()
,
setPivotX(double)
public final void setPivotY(double value)
public final double getPivotY()
public final DoubleProperty pivotYProperty()
getPivotY()
,
setPivotY(double)
public final void setPivotZ(double value)
public final double getPivotZ()
public final DoubleProperty pivotZProperty()
getPivotZ()
,
setPivotZ(double)
public final void setAxis(Point3D value)
public final Point3D getAxis()
public final ObjectProperty<Point3D> axisProperty()
getAxis()
,
setAxis(Point3D)
public double getMxx()
Transform
public double getMxy()
Transform
public double getMxz()
Transform
public double getTx()
Transform
public double getMyx()
Transform
public double getMyy()
Transform
public double getMyz()
Transform
public double getTy()
Transform
public double getMzx()
Transform
public double getMzy()
Transform
public double getMzz()
Transform
public double getTz()
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 Transform createInverse() throws NonInvertibleTransformException
Transform
createInverse
in class Transform
NonInvertibleTransformException
- if this transform
cannot be invertedpublic Rotate clone()
Transform
public Point2D transform(double x, double y)
Transform
public Point3D transform(double x, double y, double z)
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 axisPoint3D
instancepublic Point2D inverseTransform(double x, double y)
Transform
inverseTransform
in class Transform
x
- the X coordinate of the pointy
- the Y coordinate of the pointpublic Point3D inverseTransform(double x, double y, double z)
Transform
inverseTransform
in class Transform
x
- the X coordinate of the pointy
- the Y coordinate of the pointz
- the Z coordinate of the pointpublic Point2D inverseDeltaTransform(double x, double y)
Transform
inverseDeltaTransform
in class Transform
x
- 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)
Transform
inverseDeltaTransform
in class Transform
x
- vector magnitude in the direction of the X axisy
- vector magnitude in the direction of the Y axisPoint3D
instancepublic String toString()
Rotate
object.protected void transformChanged()
Transform
transformChanged
in class Transform
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.