Point2D class defines a point representing a location
in (x,y) coordinate space.
This class is only the abstract superclass for all objects that store a 2D coordinate. The actual storage representation of the coordinates is left to the subclass.
| Modifier and Type | Class and Description |
|---|---|
| public static class | Point2D.
The |
| public static class | Point2D.
The |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: a clone of this instance.Overrides java. Creates a new object of the same class and with the same contents as this object. |
| public static double | Returns: the distance between the two sets of specified coordinates.the X coordinate of the first specified point x1, double the Y coordinate of the first specified point y1, double the X coordinate of the second specified point x2, double the Y coordinate of the second specified point y2)Returns the distance between two points. |
| public double | Returns: the distance between thisPoint2D
and a specified point.the X coordinate of the specified point to be measured
against this px, double Point2Dthe Y coordinate of the specified point to be measured
against this py)Point2DReturns the distance from this |
| public double | |
| public static double | Returns: the square of the distance between the two sets of specified coordinates.the X coordinate of the first specified point x1, double the Y coordinate of the first specified point y1, double the X coordinate of the second specified point x2, double the Y coordinate of the second specified point y2)Returns the square of the distance between two points. |
| public double | Returns: the square of the distance between thisPoint2D and the specified point.the X coordinate of the specified point to be measured
against this px, double Point2Dthe Y coordinate of the specified point to be measured
against this py)Point2DReturns the square of the distance from this
|
| public double | Returns: the square of the distance between thisPoint2D to a specified Point2D.the specified point to be measured
against this pt)Point2DReturns the square of the distance from this
|
| public boolean | Returns: true if the object to be compared is
an instance of Point2D and has
the same values; false otherwise.an object to be compared with this obj)Point2DOverrides java. Determines whether or not two points are equal. |
| public abstract double | Returns: the X coordinate of thisPoint2D.Returns the X coordinate of this |
| public abstract double | Returns: the Y coordinate of thisPoint2D.Returns the Y coordinate of this |
| public int | Returns: a hash code for thisPoint2D.Overrides java. Returns the hashcode for this |
| public abstract void | setLocation(double
the new X coordinate of this x, double Point2Dthe new Y coordinate of this y)Point2DSets the location of this |
| public void | setLocation(Point2D
the specified p)Point2D to which to set
this Point2DSets the location of this |
| Point2D | back to summary |
|---|---|
| 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.
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Creates a new object of the same class and with the same contents as this object.
| |
| distance | back to summary |
|---|---|
| public static double distance(double x1, double y1, double x2, double y2) Returns the distance between two points.
| |
| distance | back to summary |
|---|---|
| public double distance(double px, double py) Returns the distance from this
| |
| distance | back to summary |
|---|---|
| public double distance(Point2D pt) Returns the distance from this
| |
| distanceSq | back to summary |
|---|---|
| public static double distanceSq(double x1, double y1, double x2, double y2) Returns the square of the distance between two points.
| |
| distanceSq | back to summary |
|---|---|
| public double distanceSq(double px, double py) Returns the square of the distance from this
| |
| distanceSq | back to summary |
|---|---|
| public double distanceSq(Point2D pt) Returns the square of the distance from this
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Determines whether or not two points are equal. Two instances of
| |
| getX | back to summary |
|---|---|
| public abstract double getX() Returns the X coordinate of this
| |
| getY | back to summary |
|---|---|
| public abstract double getY() Returns the Y coordinate of this
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns the hashcode for this
| |
| setLocation | back to summary |
|---|---|
| public abstract void setLocation(double x, double y) Sets the location of this
| |
| setLocation | back to summary |
|---|---|
| public void setLocation(Point2D p) Sets the location of this
| |
Double class defines a point specified in
double precision.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.6 for interoperability. |
| public double | x
The X coordinate of this |
| public double | y
The Y coordinate of this |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Double(double
the X coordinate of the newly
constructed x, double Point2Dthe Y coordinate of the newly
constructed y)Point2DConstructs and initializes a |
| Modifier and Type | Method and Description |
|---|---|
| public double | getX()
Implements abstract java. Returns the X coordinate of this |
| public double | getY()
Implements abstract java. Returns the Y coordinate of this |
| public void | setLocation(double x, double y)
Implements abstract java. Sets the location of this |
| public String | Returns: a string representation of thisPoint2D.Overrides java. Returns a |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Use serialVersionUID from JDK 1.6 for interoperability. | |
| x | back to summary |
|---|---|
| public double x The X coordinate of this
| |
| y | back to summary |
|---|---|
| public double y The Y coordinate of this
| |
| Double | back to summary |
|---|---|
| public Double() Constructs and initializes a
| |
| Double | back to summary |
|---|---|
| public Double(double x, double y) Constructs and initializes a
| |
| getX | back to summary |
|---|---|
| public double getX() Implements abstract java. Doc from java. Returns the X coordinate of this
| |
| getY | back to summary |
|---|---|
| public double getY() Implements abstract java. Doc from java. Returns the Y coordinate of this
| |
| setLocation | back to summary |
|---|---|
| public void setLocation(double x, double y) Implements abstract java. Doc from java. Sets the location of this
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a
| |
Float class defines a point specified in float
precision.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.6 for interoperability. |
| public float | x
The X coordinate of this |
| public float | y
The Y coordinate of this |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Float(float
the X coordinate of the newly
constructed x, float Point2Dthe Y coordinate of the newly
constructed y)Point2DConstructs and initializes a |
| Modifier and Type | Method and Description |
|---|---|
| public double | getX()
Implements abstract java. Returns the X coordinate of this |
| public double | getY()
Implements abstract java. Returns the Y coordinate of this |
| public void | setLocation(double x, double y)
Implements abstract java. Sets the location of this |
| public void | setLocation(float
the new X coordinate of this x, float Point2Dthe new Y coordinate of this y)Point2DSets the location of this |
| public String | Returns: a string representation of thisPoint2D.Overrides java. Returns a |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Use serialVersionUID from JDK 1.6 for interoperability. | |
| x | back to summary |
|---|---|
| public float x The X coordinate of this
| |
| y | back to summary |
|---|---|
| public float y The Y coordinate of this
| |
| Float | back to summary |
|---|---|
| public Float() Constructs and initializes a
| |
| Float | back to summary |
|---|---|
| public Float(float x, float y) Constructs and initializes a
| |
| getX | back to summary |
|---|---|
| public double getX() Implements abstract java. Doc from java. Returns the X coordinate of this
| |
| getY | back to summary |
|---|---|
| public double getY() Implements abstract java. Doc from java. Returns the Y coordinate of this
| |
| setLocation | back to summary |
|---|---|
| public void setLocation(double x, double y) Implements abstract java. Doc from java. Sets the location of this
| |
| setLocation | back to summary |
|---|---|
| public void setLocation(float x, float y) Sets the location of this
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a
| |