< prev index next >

modules/javafx.graphics/src/main/java/javafx/scene/transform/Rotate.java

Print this page




  27 
  28 import javafx.beans.property.DoubleProperty;
  29 import javafx.beans.property.DoublePropertyBase;
  30 import javafx.beans.property.ObjectProperty;
  31 import javafx.beans.property.ObjectPropertyBase;
  32 import javafx.geometry.Point3D;
  33 
  34 import com.sun.javafx.geom.transform.Affine3D;
  35 import com.sun.javafx.geom.transform.BaseTransform;
  36 import javafx.geometry.Point2D;
  37 
  38 
  39 /**
  40  * This class represents an {@code Affine} object that rotates coordinates
  41  * around an anchor point. This operation is equivalent to translating the
  42  * coordinates so that the anchor point is at the origin (S1), then rotating them
  43  * about the new origin (S2), and finally translating so that the
  44  * intermediate origin is restored to the coordinates of the original
  45  * anchor point (S3).
  46  * <p>
  47  * For example, the matrix representing the returned transform of
  48  *    new Rotate (theta, x, y, z) around the Z-axis
  49  *
  50  * is :
  51  * <pre>
  52  *              [   cos(theta)    -sin(theta)   0    x-x*cos+y*sin  ]
  53  *              [   sin(theta)     cos(theta)   0    y-x*sin-y*cos  ]
  54  *              [      0               0        1          z        ]
  55  * </pre>
  56  * <p>
  57  * For example, to rotate a text 30 degrees around the Z-axis at
  58  * anchor point of (50,30):
  59  * <pre>{@code
  60  * Text text = new Text("This is a test");
  61  * text.setX(10);
  62  * text.setY(50);
  63  * text.setFont(new Font(20));
  64  *
  65  * text.getTransforms().add(new Rotate(30, 50, 30));
  66  * }</pre>
  67  *
  68  * @since JavaFX 2.0
  69  */
  70 
  71 public class Rotate extends Transform {
  72 
  73     /**
  74      * Specifies the X-axis as the axis of rotation.




  27 
  28 import javafx.beans.property.DoubleProperty;
  29 import javafx.beans.property.DoublePropertyBase;
  30 import javafx.beans.property.ObjectProperty;
  31 import javafx.beans.property.ObjectPropertyBase;
  32 import javafx.geometry.Point3D;
  33 
  34 import com.sun.javafx.geom.transform.Affine3D;
  35 import com.sun.javafx.geom.transform.BaseTransform;
  36 import javafx.geometry.Point2D;
  37 
  38 
  39 /**
  40  * This class represents an {@code Affine} object that rotates coordinates
  41  * around an anchor point. This operation is equivalent to translating the
  42  * coordinates so that the anchor point is at the origin (S1), then rotating them
  43  * about the new origin (S2), and finally translating so that the
  44  * intermediate origin is restored to the coordinates of the original
  45  * anchor point (S3).
  46  * <p>
  47  * The matrix representing the rotation transformation around an axis {@code (x,y,z)}
  48  * by an angle {@code t} is as follows:


  49  * <pre>
  50  *              [   cos(t)   -sin(t)   0   x-x*cos(t)+y*sin(t)   ]
  51  *              [   sin(t)    cos(t)   0   y-x*sin(t)-y*cos(t)   ]
  52  *              [     0         0      1           z             ]
  53  * </pre>
  54  * <p>
  55  * For example, to rotate a text 30 degrees around the Z-axis at
  56  * anchor point of (50,30):
  57  * <pre>{@code
  58  * Text text = new Text("This is a test");
  59  * text.setX(10);
  60  * text.setY(50);
  61  * text.setFont(new Font(20));
  62  *
  63  * text.getTransforms().add(new Rotate(30, 50, 30));
  64  * }</pre>
  65  *
  66  * @since JavaFX 2.0
  67  */
  68 
  69 public class Rotate extends Transform {
  70 
  71     /**
  72      * Specifies the X-axis as the axis of rotation.


< prev index next >