public abstract class Point2D
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
Point2D.Double
A point with double coordinates.
|
static class |
Point2D.Float
A point with float coordinates.
|
Modifier | Constructor and Description |
---|---|
protected |
Point2D()
This is abstract class that cannot be instantiated.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
double |
distance(double px,
double py)
Get the distance from this point to a given point as a double
|
static double |
distance(double x1,
double y1,
double x2,
double y2)
Get the the distance between two points
|
double |
distance(Point2D pt)
Get the distance from this point to a given point asa double
|
double |
distanceSq(double px,
double py)
Get the square of the distance between two points
|
static double |
distanceSq(double x1,
double y1,
double x2,
double y2)
Get the square of the distance between two points
|
double |
distanceSq(Point2D pt)
Get the square of the distance of this point to a given point
|
boolean |
equals(java.lang.Object obj)
Test if this point is equal to a given object
|
abstract double |
getX()
Get the x coordinate as a double
|
abstract double |
getY()
Get the y coordinate as a double
|
abstract void |
setLocation(double x,
double y)
Set the location of this Point2D using double coordinates
|
void |
setLocation(Point2D p)
Set the location of this Point2D to the same as a specified Point2D
|
protected Point2D()
public abstract double getX()
public abstract double getY()
public abstract void setLocation(double x, double y)
x
- the new x coordinatey
- the new y coordinatepublic void setLocation(Point2D p)
p
- the specified Point2Dpublic static double distanceSq(double x1, double y1, double x2, double y2)
x1
- the x coordinate of the first pointy1
- the y coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second pointpublic static double distance(double x1, double y1, double x2, double y2)
x1
- the x coordinate of the first pointy1
- the y coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second pointpublic double distanceSq(double px, double py)
px
- the first pointpy
- the second pointpublic double distanceSq(Point2D pt)
pt
- the given pointpublic double distance(double px, double py)
px
- the x coordinate of the given pointpy
- the y coordinate of the given pointpublic double distance(Point2D pt)
pt
- the given pointpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object