FileDocCategorySizeDatePackage
Point2D.javaAPI DocAndroid 1.5 API8411Wed May 06 22:41:54 BST 2009java.awt.geom

Point2D

public abstract class Point2D extends Object implements Cloneable
The Class Point2D represents a point whose data is given in high-precision values appropriate for graphical operations.
since
Android 1.0

Fields Summary
Constructors Summary
protected Point2D()
Instantiates a new Point2D.

    
Methods Summary
public java.lang.Objectclone()

        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            throw new InternalError();
        }
    
public doubledistance(double px, double py)
Finds the distance between this point and the specified point.

param
px the x coordinate of the point.
param
py the y coordinate of the point.
return
the distance between this point and the specified point.

        return Math.sqrt(distanceSq(px, py));
    
public doubledistance(java.awt.geom.Point2D p)
Finds the distance between this point and the specified point.

param
p the other point.
return
the distance between this point and the specified point.

        return Math.sqrt(distanceSq(p));
    
public static doubledistance(double x1, double y1, double x2, double y2)
Finds the distance between the two specified points.

param
x1 the x coordinate of the first point.
param
y1 the y coordinate of the first point.
param
x2 the x coordinate of the second point.
param
y2 the y coordinate of the second point.
return
the distance between the two specified points.

        return Math.sqrt(distanceSq(x1, y1, x2, y2));
    
public static doubledistanceSq(double x1, double y1, double x2, double y2)
Finds the square of the distance between the two specified points.

param
x1 the x coordinate of the first point.
param
y1 the y coordinate of the first point.
param
x2 the x coordinate of the second point.
param
y2 the y coordinate of the second point.
return
the square of the distance between the two specified points.

        x2 -= x1;
        y2 -= y1;
        return x2 * x2 + y2 * y2;
    
public doubledistanceSq(double px, double py)
Finds the square of the distance between this point and the specified point.

param
px the x coordinate of the point.
param
py the y coordinate of the point.
return
the square of the distance between this point and the specified point.

        return Point2D.distanceSq(getX(), getY(), px, py);
    
public doubledistanceSq(java.awt.geom.Point2D p)
Finds the square of the distance between this point and the specified point.

param
p the other point.
return
the square of the distance between this point and the specified point.

        return Point2D.distanceSq(getX(), getY(), p.getX(), p.getY());
    
public booleanequals(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 doublegetX()
Gets the x coordinate.

return
the x coordinate.

public abstract doublegetY()
Gets the y coordinate.

return
the y coordinate.

public inthashCode()

        HashCode hash = new HashCode();
        hash.append(getX());
        hash.append(getY());
        return hash.hashCode();
    
public abstract voidsetLocation(double x, double y)
Sets the point's coordinates.

param
x the x coordinate.
param
y the y coordinate.

public voidsetLocation(java.awt.geom.Point2D p)
Sets the point's coordinates by copying them from another point.

param
p the point to copy the data from.

        setLocation(p.getX(), p.getY());