Java Platform 1.2
Beta 4

Class java.awt.geom.Point2D

java.lang.Object
  |
  +--java.awt.geom.Point2D
Direct Known Subclasses:
Point, Point2D.Double, Point2D.Float

public abstract class Point2D
extends Object
implements Cloneable
A point representing a location in (x, y) coordinate space.

This class is only the abstract superclass for all objects which store a 2D coordinate. The actual storage representation of the coordinates is left to the subclass.


Inner Class Summary
static  Point2D.Double
          A point specified in double precision.
static  Point2D.Float
          A point specified in float precision.
 
Constructor Summary
Point2D()
          This is an abstract class that cannot be instantiated directly.
 
Method Summary
 Object clone()
          Creates a new object of the same class as this object.
static double distance(double X1, double Y1, double X2, double Y2)
          Returns the distance between two points.
 double distance(double PX, double PY)
          Returns the distance from this point to another.
 double distance(Point2D pt)
          Returns the distance from this point to another.
static double distanceSq(double X1, double Y1, double X2, double Y2)
          Returns the square of the distance between two points.
 double distanceSq(double PX, double PY)
          Returns the square of the distance from this point to another.
 double distanceSq(Point2D pt)
          Returns the square of the distance from this point to another.
 boolean equals(Object obj)
          Determines whether two points are equal.
abstract  double getX()
          Returns the X coordinate of the point in double precision.
abstract  double getY()
          Returns the Y coordinate of the point in double precision.
abstract  void setLocation(double x, double y)
          Sets the location of this point to the specified float coordinates.
 void setLocation(Point2D p)
          Sets the location of this point to the same coordinates as the specified Point object.
 
Methods inherited from class java.lang.Object
finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

Constructor Detail

Point2D

protected Point2D()
This is an abstract class that cannot be instantiated directly. Type-specific implementation subclasses are available for instantiation and provide a number of formats for storing the information necessary to satisfy the various accessor methods below.
See Also:
Point2D.Float, Point2D.Double, Point
Method Detail

getX

public abstract double getX()
Returns the X coordinate of the point in double precision.
Since:
JDK1.2

getY

public abstract double getY()
Returns the Y coordinate of the point in double precision.
Since:
JDK1.2

setLocation

public abstract void setLocation(double x,
                                 double y)
Sets the location of this point to the specified float coordinates.
Since:
JDK1.2

setLocation

public void setLocation(Point2D p)
Sets the location of this point to the same coordinates as the specified Point object.
Since:
JDK1.2

distanceSq

public static double distanceSq(double X1,
                                double Y1,
                                double X2,
                                double Y2)
Returns the square of the distance between two points.
Parameters:
X1 - the x coordinate of the first point
Y1 - the y coordinate of the first point
X2 - the x coordinate of the second point
Y2 - the y coordinate of the second point

distance

public static double distance(double X1,
                              double Y1,
                              double X2,
                              double Y2)
Returns the distance between two points.
Parameters:
X1 - the x coordinate of the first point
Y1 - the y coordinate of the first point
X2 - the x coordinate of the second point
Y2 - the y coordinate of the second point

distanceSq

public double distanceSq(double PX,
                         double PY)
Returns the square of the distance from this point to another.
Parameters:
PX - the x coordinate of the other point
PY - the y coordinate of the other point

distanceSq

public double distanceSq(Point2D pt)
Returns the square of the distance from this point to another.
Parameters:
pt - the other point

distance

public double distance(double PX,
                       double PY)
Returns the distance from this point to another.
Parameters:
PX - the x coordinate of the other point
PY - the y coordinate of the other point

distance

public double distance(Point2D pt)
Returns the distance from this point to another.
Parameters:
pt - the other point

clone

public Object clone()
Creates a new object of the same class as this object.
Returns:
a clone of this instance.
Throws:
OutOfMemoryError - if there is not enough memory.
Overrides:
clone in class Object
Since:
JDK1.2
See Also:
Cloneable

equals

public boolean equals(Object obj)
Determines whether 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.
Parameters:
obj - an object to be compared with this point.
Returns:
true if the object to be compared is an instance of Point2D and has the same values; false otherwise.
Overrides:
equals in class Object
Since:
JDK1.2

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.