Class Point3D

java.lang.Object
org.bzdev.geom.Point3D
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
Point3D.Double, Point3D.Float

public abstract class Point3D extends Object implements Cloneable
Class representing a point in three dimensions.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Class representing points in three dimensions using double-precision coordinates
    static class 
    Class representing points in three dimensions using double-precision coordinates
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Clone this object.
    double
    distance(double px, double py, double pz)
    Get the distance from this point to another point given coordinates.
    static double
    distance(double x1, double y1, double z1, double x2, double y2, double z2)
    Get the distance between two points given their coordinates.
    double
    Get the distance from this point to another point.
    double
    distanceSq(double x, double y, double z)
    Get the square of the distance from this point to another point given coordinates.
    static double
    distanceSq(double x1, double y1, double z1, double x2, double y2, double z2)
    Get the square of the distance between two points given their coordinates.
    double
    Get the square of the distance from this point to another point.
    boolean
     
    abstract double
    Get the X coordinate of this point.
    abstract double
    Get the Y coordinate of this point.
    abstract double
    Get the Z coordinate of this point.
    int
     
    abstract void
    setLocation(double x, double y, double z)
    Set the location of this point given the location's coordinates.
    void
    Set the location of this point to the location of another point

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Point3D

      protected Point3D()
      Constructor.
  • Method Details

    • distance

      public double distance(double px, double py, double pz)
      Get the distance from this point to another point given coordinates.
      Parameters:
      px - the X coordinate of the other point
      py - the Y coordinate of the other point
      pz - the Z coordinate of the other point
      Returns:
      the distance to the point (px, py, pz)
    • distance

      public static double distance(double x1, double y1, double z1, double x2, double y2, double z2)
      Get the distance between two points given their coordinates.
      Parameters:
      x1 - the X coordinate of the first point
      y1 - the Y coordinate of the first point
      z1 - the Z coordinate of the first point
      x2 - the X coordinate of the second point
      y2 - the Y coordinate of the second point
      z2 - the Z coordinate of the second point
      Returns:
      the distance between two specified points
    • distance

      public double distance(Point3D pt)
      Get the distance from this point to another point.
      Parameters:
      pt - a point
      Returns:
      the distance from this point to point pt
    • distanceSq

      public double distanceSq(double x, double y, double z)
      Get the square of the distance from this point to another point given coordinates.
      Parameters:
      x - the X coordinate of the other point
      y - the Y coordinate of the other point
      z - the Z coordinate of the other point
      Returns:
      the square of the distance to the point (px, py, pz)
    • distanceSq

      public static double distanceSq(double x1, double y1, double z1, double x2, double y2, double z2)
      Get the square of the distance between two points given their coordinates.
      Parameters:
      x1 - the X coordinate of the first point
      y1 - the Y coordinate of the first point
      z1 - the Z coordinate of the first point
      x2 - the X coordinate of the second point
      y2 - the Y coordinate of the second point
      z2 - the Z coordinate of the second point
      Returns:
      the square of the distance between two specified points
    • distanceSq

      public double distanceSq(Point3D pt)
      Get the square of the distance from this point to another point.
      Parameters:
      pt - a point
      Returns:
      the square of the distance from this point to point pt
    • getX

      public abstract double getX()
      Get the X coordinate of this point.
      Returns:
      the X coordinate
    • getY

      public abstract double getY()
      Get the Y coordinate of this point.
      Returns:
      the Y coordinate
    • getZ

      public abstract double getZ()
      Get the Z coordinate of this point.
      Returns:
      the Z coordinate
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • setLocation

      public abstract void setLocation(double x, double y, double z)
      Set the location of this point given the location's coordinates.
      Parameters:
      x - the X coordinate for this point's location
      y - the Y coordinate for this point's location
      z - the Z coordinate for this point's location
    • setLocation

      public void setLocation(Point3D p)
      Set the location of this point to the location of another point
      Parameters:
      p - the point whose location will determine the location of this point
    • clone

      public Object clone()
      Clone this object. The new object will have the same X, Y, and Z coordinates
      Overrides:
      clone in class Object
      Returns:
      a clone of this object