java.lang.Object
org.bzdev.geom.Point3D
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
Point3D.Double
,Point3D.Float
Class representing a point in three dimensions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class representing points in three dimensions using double-precision coordinatesstatic class
Class representing points in three dimensions using double-precision coordinates -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
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
distanceSq
(Point3D pt) Get the square of the distance from this point to another point.boolean
abstract double
getX()
Get the X coordinate of this point.abstract double
getY()
Get the Y coordinate of this point.abstract double
getZ()
Get the Z coordinate of this point.int
hashCode()
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
-
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 pointpy
- the Y coordinate of the other pointpz
- 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 pointy1
- the Y coordinate of the first pointz1
- the Z coordinate of the first pointx2
- the X coordinate of the second pointy2
- the Y coordinate of the second pointz2
- the Z coordinate of the second point- Returns:
- the distance between two specified points
-
distance
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 pointy
- the Y coordinate of the other pointz
- 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 pointy1
- the Y coordinate of the first pointz1
- the Z coordinate of the first pointx2
- the X coordinate of the second pointy2
- the Y coordinate of the second pointz2
- the Z coordinate of the second point- Returns:
- the square of the distance between two specified points
-
distanceSq
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() -
equals
-
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 locationy
- the Y coordinate for this point's locationz
- the Z coordinate for this point's location
-
setLocation
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
Clone this object. The new object will have the same X, Y, and Z coordinates
-