Methods Summary |
---|
public java.lang.Object | clone()
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new InternalError();
}
|
public double | distance(double px, double py)Finds the distance between this point and the specified point.
return Math.sqrt(distanceSq(px, py));
|
public double | distance(java.awt.geom.Point2D p)Finds the distance between this point and the specified point.
return Math.sqrt(distanceSq(p));
|
public static double | distance(double x1, double y1, double x2, double y2)Finds the distance between the two specified points.
return Math.sqrt(distanceSq(x1, y1, x2, y2));
|
public static double | distanceSq(double x1, double y1, double x2, double y2)Finds the square of the distance between the two specified points.
x2 -= x1;
y2 -= y1;
return x2 * x2 + y2 * y2;
|
public double | distanceSq(double px, double py)Finds the square of the distance between this point and the specified
point.
return Point2D.distanceSq(getX(), getY(), px, py);
|
public double | distanceSq(java.awt.geom.Point2D p)Finds the square of the distance between this point and the specified
point.
return Point2D.distanceSq(getX(), getY(), p.getX(), p.getY());
|
public boolean | equals(java.lang.Object obj)
if (obj == this) {
return true;
}
if (obj instanceof Point2D) {
Point2D p = (Point2D)obj;
return getX() == p.getX() && getY() == p.getY();
}
return false;
|
public abstract double | getX()Gets the x coordinate.
|
public abstract double | getY()Gets the y coordinate.
|
public int | hashCode()
HashCode hash = new HashCode();
hash.append(getX());
hash.append(getY());
return hash.hashCode();
|
public abstract void | setLocation(double x, double y)Sets the point's coordinates.
|
public void | setLocation(java.awt.geom.Point2D p)Sets the point's coordinates by copying them from another point.
setLocation(p.getX(), p.getY());
|