Point2D class defines a point representing a location
in (x,y) coordinate space.
| Modifier and Type | Field and Description |
|---|---|
| public float | x
The X coordinate of this |
| public float | y
The Y coordinate of this |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Point2D(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 static float | Returns: the distance between the two sets of specified coordinates.the X coordinate of the first specified point x1, float the Y coordinate of the first specified point y1, float the X coordinate of the second specified point x2, float the Y coordinate of the second specified point y2)Returns the distance between two points. |
| public float | Returns: the distance between thisPoint2D
and a specified point.the X coordinate of the specified point to be measured
against this px, float Point2Dthe Y coordinate of the specified point to be measured
against this py)Point2DReturns the distance from this |
| public float | |
| public static float | Returns: the square of the distance between the two sets of specified coordinates.the X coordinate of the first specified point x1, float the Y coordinate of the first specified point y1, float the X coordinate of the second specified point x2, float the Y coordinate of the second specified point y2)Returns the square of the distance between two points. |
| public float | 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, float Point2Dthe Y coordinate of the specified point to be measured
against this py)Point2DReturns the square of the distance from this
|
| public float | 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 int | Returns: a hash code for thisPoint2D.Overrides java. Returns the hashcode for 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 void | setLocation(Point2D
the specified p)Point2D to which to set
this Point2DSets the location of this |
| public String | Returns: a string representation of thisPoint2D.Overrides java. Returns a |
| x | back to summary |
|---|---|
| public float x The X coordinate of this | |
| y | back to summary |
|---|---|
| public float y The Y coordinate of this | |
| Point2D | back to summary |
|---|---|
| public Point2D() Constructs and initializes a | |
| Point2D | back to summary |
|---|---|
| public Point2D(float x, float y) Constructs and initializes a
| |
| distance | back to summary |
|---|---|
| public static float distance(float x1, float y1, float x2, float y2) Returns the distance between two points.
| |
| distance | back to summary |
|---|---|
| public float distance(float px, float py) Returns the distance from this
| |
| distance | back to summary |
|---|---|
| public float distance(Point2D pt) Returns the distance from this
| |
| distanceSq | back to summary |
|---|---|
| public static float distanceSq(float x1, float y1, float x2, float y2) Returns the square of the distance between two points.
| |
| distanceSq | back to summary |
|---|---|
| public float distanceSq(float px, float py) Returns the square of the distance from this
| |
| distanceSq | back to summary |
|---|---|
| public float 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
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns the hashcode for this
| |
| setLocation | back to summary |
|---|---|
| public void setLocation(float x, float y) Sets the location of this
| |
| setLocation | back to summary |
|---|---|
| public void setLocation(Point2D p) Sets the location of this
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a | |