Class Point3D

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

public final class Point3D extends Object implements Serializable
A point in 3D space (this class is also used to represent vectors in 3D space). Instances of this class are immutable.

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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Point3D
    The origin (0, 0, 0).
    static final Point3D
    The point (1, 0, 0).
    static final Point3D
    The point (0, 1, 0).
    static final Point3D
    The point (0, 0, 1).
    double
    The x-coordinate.
    double
    The y-coordinate.
    double
    The z-coordinate.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Point3D(double x, double y, double z)
    Creates a new point in 3D space.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Point3D
    createPoint3D(double theta, double phi, double rho)
    Creates a new Point3D instance from spherical coordinates.
    boolean
    Tests this instance for equality to an arbitrary object.
    double
    Returns phi (calculated from the cartesian coordinates).
    double
    Returns rho (calculated from the cartesian coordinates).
    double
    Returns theta (calculated from the cartesian coordinates).
    double
    Returns the x-coordinate specified in the constructor.
    double
    Returns the y-coordinate specified in the constructor.
    double
    Returns the z-coordinate specified in the constructor.
    int
     
    Returns a string representation of this instance, primarily for debugging purposes.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ORIGIN

      public static final Point3D ORIGIN
      The origin (0, 0, 0).
    • UNIT_X

      public static final Point3D UNIT_X
      The point (1, 0, 0).
    • UNIT_Y

      public static final Point3D UNIT_Y
      The point (0, 1, 0).
    • UNIT_Z

      public static final Point3D UNIT_Z
      The point (0, 0, 1).
    • x

      public double x
      The x-coordinate.
    • y

      public double y
      The y-coordinate.
    • z

      public double z
      The z-coordinate.
  • Constructor Details

    • Point3D

      public Point3D(double x, double y, double z)
      Creates a new point in 3D space.
      Parameters:
      x - the x-coordinate.
      y - the y-coordinate.
      z - the z-coordinate.
  • Method Details

    • createPoint3D

      public static Point3D createPoint3D(double theta, double phi, double rho)
      Creates a new Point3D instance from spherical coordinates.
      Parameters:
      theta - theta (in radians).
      phi - phi (in radians).
      rho - the distance from the origin.
      Returns:
      The point (never null).
    • getX

      public double getX()
      Returns the x-coordinate specified in the constructor.
      Returns:
      The x-coordinate.
    • getY

      public double getY()
      Returns the y-coordinate specified in the constructor.
      Returns:
      The y-coordinate.
    • getZ

      public double getZ()
      Returns the z-coordinate specified in the constructor.
      Returns:
      The z-coordinate.
    • getTheta

      public double getTheta()
      Returns theta (calculated from the cartesian coordinates).
      Returns:
      Theta.
    • getPhi

      public double getPhi()
      Returns phi (calculated from the cartesian coordinates).
      Returns:
      phi.
    • getRho

      public double getRho()
      Returns rho (calculated from the cartesian coordinates).
      Returns:
      rho.
    • equals

      public boolean equals(Object obj)
      Tests this instance for equality to an arbitrary object.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object (null permitted).
      Returns:
      A boolean.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation of this instance, primarily for debugging purposes.
      Overrides:
      toString in class Object
      Returns:
      A string (never null).