Class Point3D

java.lang.Object
ucar.nc2.dt.ugrid.geom.Point3D
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
Point3D.Double, Point3D.Float

public abstract class Point3D extends Object implements Cloneable
The Point3D class defines a point representing a location in (x,y,z) coordinate space.

This class is only the abstract superclass for all objects that store a 3D coordinate. The actual storage representation of the coordinates is left to the subclass.

This class is modeled after the java.awt.geom.Point3D class.

NOTE: This class should NOT be used for geographic information. Use LatLonPoint3D instead.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The Double class defines a point specified in double precision.
    static class 
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    This is an abstract class that cannot be instantiated directly.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new object of the same class and with the same contents as this object.
    double
    distance(double px, double py, double pz)
    Returns the distance from this Point3D to a specified point.
    static double
    distance(double x1, double y1, double z1, double x2, double y2, double z2)
    Returns the distance between two points.
    double
    Returns the distance from this Point3D to a specified Point3D.
    double
    distanceSq(double px, double py, double pz)
    Returns the square of the distance from this Point3D to a specified point.
    static double
    distanceSq(double x1, double y1, double z1, double x2, double y2, double z2)
    Returns the square of the distance between two points.
    double
    Returns the square of the distance from this Point3D to a specified Point3D.
    boolean
    Determines whether or not two points are equal.
    abstract double
    Returns the X coordinate of this Point3D in double precision.
    abstract double
    Returns the Y coordinate of this Point3D in double precision.
    abstract double
    Returns the Z coordinate of this Point3D in double precision.
    abstract void
    moveBy(double dx, double dy, double dz)
    Moves the Point3D by the amount indicated by the specified double magnitudes.
    abstract void
    setLocation(double x, double y, double z)
    Sets the location of this Point3D to the specified double coordinates.
    void
    Sets the location of this Point3D to the same coordinates as the specified Point3D object.

    Methods inherited from class java.lang.Object

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

    • Point3D

      protected Point3D()
      This is an abstract class that cannot be instantiated directly. Type-specific implementation subclasses are available for instantiation and provide a number of formats for storing the information necessary to satisfy the various accessor methods below. see java.awt.geom.Point3D.Float see java.awt.geom.Point3D.Double
      See Also:
  • Method Details

    • getX

      public abstract double getX()
      Returns the X coordinate of this Point3D in double precision.
      Returns:
      the X coordinate of this Point3D.
    • getY

      public abstract double getY()
      Returns the Y coordinate of this Point3D in double precision.
      Returns:
      the Y coordinate of this Point3D.
    • getZ

      public abstract double getZ()
      Returns the Z coordinate of this Point3D in double precision.
      Returns:
      the Z coordinate of this Point3D.
    • setLocation

      public abstract void setLocation(double x, double y, double z)
      Sets the location of this Point3D to the specified double coordinates.
      Parameters:
      x - the new X coordinate of this Point3D
      y - the new Y coordinate of this Point3D
      z - the new Z coordinate of this Point3D
    • setLocation

      public void setLocation(Point3D p)
      Sets the location of this Point3D to the same coordinates as the specified Point3D object.
      Parameters:
      p - the specified Point3D to which to set this Point3D
    • moveBy

      public abstract void moveBy(double dx, double dy, double dz)
      Moves the Point3D by the amount indicated by the specified double magnitudes.

      NOTE: Units are NOT considered. The units of the origin and (u, v, w) components are assumed to be the same.
      Therefore conversions (i.e. from DD to Meters) should happen BEFORE calling this method.

      Parameters:
      dx - the amount to move this Point3D in the X direction
      dy - the amount to move this Point3D in the Y direction
      dz - the amount to move this Point3D in the Z direction
    • distanceSq

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

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

      public double distanceSq(double px, double py, double pz)
      Returns the square of the distance from this Point3D to a specified point.
      Parameters:
      px - the X coordinate of the specified point to be measured against this Point3D
      py - the Y coordinate of the specified point to be measured against this Point3D
      pz - the Z coordinate of the specified point to be measured against this Point3D
      Returns:
      the square of the distance between this Point3D and the specified point.
    • distance

      public double distance(double px, double py, double pz)
      Returns the distance from this Point3D to a specified point.
      Parameters:
      px - the X coordinate of the specified point to be measured against this Point3D
      py - the Y coordinate of the specified point to be measured against this Point3D
      pz - the Z coordinate of the specified point to be measured against this Point3D
      Returns:
      the distance between this Point3D and a specified point.
    • distanceSq

      public double distanceSq(Point3D pt)
      Returns the square of the distance from this Point3D to a specified Point3D.
      Parameters:
      pt - the specified point to be measured against this Point3D
      Returns:
      the square of the distance between this Point3D to a specified Point3D.
    • distance

      public double distance(Point3D pt)
      Returns the distance from this Point3D to a specified Point3D.
      Parameters:
      pt - the specified point to be measured against this Point3D
      Returns:
      the distance between this Point3D and the specified Point3D.
    • clone

      public Object clone()
      Creates a new object of the same class and with the same contents as this object.
      Overrides:
      clone in class Object
      Returns:
      a clone of this instance.
      Throws:
      OutOfMemoryError - if there is not enough memory.
      See Also:
    • equals

      public boolean equals(Object obj)
      Determines whether or not two points are equal. Two instances of Point3D are equal if the values of their x , y and z member fields, representing their position in the coordinate space, are the same.
      Overrides:
      equals in class Object
      Parameters:
      obj - an object to be compared with this Point3D
      Returns:
      true if the object to be compared is an instance of Point3D and has the same values; false otherwise.