|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.geom.Point2D
public abstract class Point2D
An abstract class for a point. Subclasses implement float, double and integer coordinates.
Nested Class Summary | |
---|---|
static class |
Point2D.Double
A point with double coordinates. |
static class |
Point2D.Float
A point with float coordinates. |
Constructor Summary | |
---|---|
protected |
Point2D()
This is abstract class that cannot be instantiated. |
Method Summary | |
---|---|
Object |
clone()
Create a copy of this object, using a shallow copy. |
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(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 |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Point2D()
Method Detail |
---|
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 point
public 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 point
public double distanceSq(double px, double py)
px
- the first pointpy
- the second point
public double distanceSq(Point2D pt)
pt
- the given point
public double distance(double px, double py)
px
- the x coordinate of the given pointpy
- the y coordinate of the given point
public double distance(Point2D pt)
pt
- the given point
public boolean equals(Object obj)
equals
in class Object
public Object clone()
Object
clone
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |