Methods Summary |
---|
public java.lang.Object | clone()Creates a new object of the same class and with the
same contents as this object.
try {
return super.clone();
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
|
public double | distance(double PX, double PY)Returns the distance from this Point2D to
a specified point.
PX -= getX();
PY -= getY();
return Math.sqrt(PX * PX + PY * PY);
|
public double | distance(java.awt.geom.Point2D pt)Returns the distance from this Point2D to a
specified Point2D .
double PX = pt.getX() - this.getX();
double PY = pt.getY() - this.getY();
return Math.sqrt(PX * PX + PY * PY);
|
public static double | distance(double X1, double Y1, double X2, double Y2)Returns the distance between two points.
X1 -= X2;
Y1 -= Y2;
return Math.sqrt(X1 * X1 + Y1 * Y1);
|
public static double | distanceSq(double X1, double Y1, double X2, double Y2)Returns the square of the distance between two points.
X1 -= X2;
Y1 -= Y2;
return (X1 * X1 + Y1 * Y1);
|
public double | distanceSq(double PX, double PY)Returns the square of the distance from this
Point2D to a specified point.
PX -= getX();
PY -= getY();
return (PX * PX + PY * PY);
|
public double | distanceSq(java.awt.geom.Point2D pt)Returns the square of the distance from this
Point2D to a specified Point2D .
double PX = pt.getX() - this.getX();
double PY = pt.getY() - this.getY();
return (PX * PX + PY * PY);
|
public boolean | equals(java.lang.Object obj)Determines whether or not two points are equal. Two instances of
Point2D are equal if the values of their
x and y member fields, representing
their position in the coordinate space, are the same.
if (obj instanceof Point2D) {
Point2D p2d = (Point2D) obj;
return (getX() == p2d.getX()) && (getY() == p2d.getY());
}
return super.equals(obj);
|
public abstract double | getX()Returns the X coordinate of this Point2D in
double precision.
|
public abstract double | getY()Returns the Y coordinate of this Point2D in
double precision.
|
public int | hashCode()Returns the hashcode for this Point2D .
long bits = java.lang.Double.doubleToLongBits(getX());
bits ^= java.lang.Double.doubleToLongBits(getY()) * 31;
return (((int) bits) ^ ((int) (bits >> 32)));
|
public abstract void | setLocation(double x, double y)Sets the location of this Point2D to the
specified double coordinates.
|
public void | setLocation(java.awt.geom.Point2D p)Sets the location of this Point2D to the same
coordinates as the specified Point2D object.
setLocation(p.getX(), p.getY());
|