Package ucar.nc2.dt.ugrid.geom
Class Point3D
java.lang.Object
ucar.nc2.dt.ugrid.geom.Point3D
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
Point3D.Double,Point3D.Float
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 ClassesModifier and TypeClassDescriptionstatic classTheDoubleclass defines a point specified indoubleprecision.static class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPoint3D()This is an abstract class that cannot be instantiated directly. -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a new object of the same class and with the same contents as this object.doubledistance(double px, double py, double pz) Returns the distance from thisPoint3Dto a specified point.static doubledistance(double x1, double y1, double z1, double x2, double y2, double z2) Returns the distance between two points.doubleReturns the distance from thisPoint3Dto a specifiedPoint3D.doubledistanceSq(double px, double py, double pz) Returns the square of the distance from thisPoint3Dto a specified point.static doubledistanceSq(double x1, double y1, double z1, double x2, double y2, double z2) Returns the square of the distance between two points.doubledistanceSq(Point3D pt) Returns the square of the distance from thisPoint3Dto a specifiedPoint3D.booleanDetermines whether or not two points are equal.abstract doublegetX()Returns the X coordinate of thisPoint3Dindoubleprecision.abstract doublegetY()Returns the Y coordinate of thisPoint3Dindoubleprecision.abstract doublegetZ()Returns the Z coordinate of thisPoint3Dindoubleprecision.abstract voidmoveBy(double dx, double dy, double dz) Moves thePoint3Dby the amount indicated by the specifieddoublemagnitudes.abstract voidsetLocation(double x, double y, double z) Sets the location of thisPoint3Dto the specifieddoublecoordinates.voidSets the location of thisPoint3Dto the same coordinates as the specifiedPoint3Dobject.
-
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 thisPoint3Dindoubleprecision.- Returns:
- the X coordinate of this
Point3D.
-
getY
public abstract double getY()Returns the Y coordinate of thisPoint3Dindoubleprecision.- Returns:
- the Y coordinate of this
Point3D.
-
getZ
public abstract double getZ()Returns the Z coordinate of thisPoint3Dindoubleprecision.- Returns:
- the Z coordinate of this
Point3D.
-
setLocation
public abstract void setLocation(double x, double y, double z) Sets the location of thisPoint3Dto the specifieddoublecoordinates.- Parameters:
x- the new X coordinate of thisPoint3Dy- the new Y coordinate of thisPoint3Dz- the new Z coordinate of thisPoint3D
-
setLocation
Sets the location of thisPoint3Dto the same coordinates as the specifiedPoint3Dobject.- Parameters:
p- the specifiedPoint3Dto which to set thisPoint3D
-
moveBy
public abstract void moveBy(double dx, double dy, double dz) Moves thePoint3Dby the amount indicated by the specifieddoublemagnitudes.NOTE: Units are NOT considered. The units of the
originand(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 thisPoint3Din the X directiondy- the amount to move thisPoint3Din the Y directiondz- the amount to move thisPoint3Din 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 pointy1- the Y coordinate of the first specified pointz1- the Z coordinate of the first specified pointx2- the X coordinate of the second specified pointy2- the Y coordinate of the second specified pointz2- 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 pointy1- the Y coordinate of the first specified pointz1- the Z coordinate of the first specified pointx2- the X coordinate of the second specified pointy2- the Y coordinate of the second specified pointz2- 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 thisPoint3Dto a specified point.- Parameters:
px- the X coordinate of the specified point to be measured against thisPoint3Dpy- the Y coordinate of the specified point to be measured against thisPoint3Dpz- the Z coordinate of the specified point to be measured against thisPoint3D- Returns:
- the square of the distance between this
Point3Dand the specified point.
-
distance
public double distance(double px, double py, double pz) Returns the distance from thisPoint3Dto a specified point.- Parameters:
px- the X coordinate of the specified point to be measured against thisPoint3Dpy- the Y coordinate of the specified point to be measured against thisPoint3Dpz- the Z coordinate of the specified point to be measured against thisPoint3D- Returns:
- the distance between this
Point3Dand a specified point.
-
distanceSq
Returns the square of the distance from thisPoint3Dto a specifiedPoint3D.- Parameters:
pt- the specified point to be measured against thisPoint3D- Returns:
- the square of the distance between this
Point3Dto a specifiedPoint3D.
-
distance
Returns the distance from thisPoint3Dto a specifiedPoint3D.- Parameters:
pt- the specified point to be measured against thisPoint3D- Returns:
- the distance between this
Point3Dand the specifiedPoint3D.
-
clone
Creates a new object of the same class and with the same contents as this object.- Overrides:
clonein classObject- Returns:
- a clone of this instance.
- Throws:
OutOfMemoryError- if there is not enough memory.- See Also:
-
equals
Determines whether or not two points are equal. Two instances ofPoint3Dare equal if the values of theirx,yandzmember fields, representing their position in the coordinate space, are the same.
-