Class Rotate3D

java.lang.Object
org.jfree.chart3d.graphics3d.Rotate3D
All Implemented Interfaces:
Serializable

public class Rotate3D extends Object implements Serializable
Performs rotations about along an arbitrary axis (defined by two Point3D instances). This file is derived from code published in "Computer Graphics for Java Programmers (Second Edition)" by Leen Ammeraal and Kang Zhang.

NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Rotate3D(Point3D a, Point3D b, double angle)
    Creates a new instance that will rotate points about the axis passing through points a and b, by the specified angle.
  • Method Summary

    Modifier and Type
    Method
    Description
    applyRotation(double x, double y, double z)
    Creates an returns a new point that is the rotation of the point (x, y, z) about the axis that was specified via the constructor.
    double[]
    applyRotation(double x, double y, double z, double[] result)
    Returns the coordinates of a point that is the rotation of the point (x, y, z) about the axis that was specified via the constructor.
    Creates and returns a new point that is the rotation of p about the axis that was specified via the constructor.
    double
    Returns the angle of rotation, in radians.
    void
    setAngle(double angle)
    Sets the angle of rotation (in radians) and (internally) updates the values of the transformation matrix ready for the next call(s) to the applyRotation methods.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Rotate3D

      public Rotate3D(Point3D a, Point3D b, double angle)
      Creates a new instance that will rotate points about the axis passing through points a and b, by the specified angle.
      Parameters:
      a - the first point defining the axis of rotation (null not permitted).
      b - the second point defining the axis of rotation (null not permitted).
      angle - the rotation angle (in radians).
  • Method Details

    • getAngle

      public double getAngle()
      Returns the angle of rotation, in radians.
      Returns:
      The angle of rotation, in radians.
    • setAngle

      public void setAngle(double angle)
      Sets the angle of rotation (in radians) and (internally) updates the values of the transformation matrix ready for the next call(s) to the applyRotation methods.
      Parameters:
      angle - the angle (in radians).
    • applyRotation

      Creates and returns a new point that is the rotation of p about the axis that was specified via the constructor.
      Parameters:
      p - the point (null not permitted).
      Returns:
      A new point.
    • applyRotation

      public Point3D applyRotation(double x, double y, double z)
      Creates an returns a new point that is the rotation of the point (x, y, z) about the axis that was specified via the constructor.
      Parameters:
      x - the x-coordinate of the point to transform.
      y - the y-coordinate of the point to transform.
      z - the z-coordinate of the point to transform.
      Returns:
      The transformed point (never null).
    • applyRotation

      public double[] applyRotation(double x, double y, double z, double[] result)
      Returns the coordinates of a point that is the rotation of the point (x, y, z) about the axis that was specified via the constructor.
      Parameters:
      x - the x-coordinate of the point to transform.
      y - the y-coordinate of the point to transform.
      z - the z-coordinate of the point to transform.
      result - an array to carry the result (null permitted).
      Returns:
      The transformed coordinates (in the result array if one was supplied, otherwise in a newly allocated array).