Cloneable
Point
, Point2D.Double
, Point2D.Float
The
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.
Nested Classes
static class
The Double
class defines a point specified in double
precision.
static class
The Float
class defines a point specified in float precision.
Constructors
protected
This is an abstract class that cannot be instantiated directly.
Creates a new object of the same class and with the same contents as this object.
double
Returns the distance from this Point2D
to a specified point.
static double
distance(double x1, double y1, double x2, double y2)
Returns the distance between two points.
double
Returns the distance from this Point2D
to a specified Point2D
.
double
Returns the square of the distance from this Point2D
to a specified point.
static double
distanceSq(double x1, double y1, double x2, double y2)
Returns the square of the distance between two points.
double
Returns the square of the distance from this Point2D
to a specified Point2D
.
boolean
Determines whether or not two points are equal.
abstract double
Returns the X coordinate of this Point2D
in double
precision.
abstract double
Returns the Y coordinate of this Point2D
in double
precision.
int
Returns the hashcode for this Point2D
.
abstract void
Sets the location of this Point2D
to the specified double
coordinates.
void
Sets the location of this Point2D
to the same coordinates as the specified Point2D
object.
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.
public abstract double getX()
Returns the X coordinate of this Point2D
in double
precision.
Point2D
.
public abstract double getY()
Returns the Y coordinate of this Point2D
in double
precision.
Point2D
.
public abstract void setLocation(double x, double y)
Sets the location of this Point2D
to the specified double
coordinates.
x
- the new X coordinate of this Point2D
y
- the new Y coordinate of this Point2D
Sets the location of this Point2D
to the same coordinates as the specified Point2D
object.
p
- the specified Point2D
to which to set this Point2D
public static double distanceSq(double x1, double y1, double x2, double y2)
Returns the square of the distance between two points.
x1
- the X coordinate of the first specified point
y1
- the Y coordinate of the first specified point
x2
- the X coordinate of the second specified point
y2
- the Y coordinate of the second specified point
public static double distance(double x1, double y1, double x2, double y2)
Returns the distance between two points.
x1
- the X coordinate of the first specified point
y1
- the Y coordinate of the first specified point
x2
- the X coordinate of the second specified point
y2
- the Y coordinate of the second specified point
public double distanceSq(double px, double py)
Returns the square of the distance from this Point2D
to a specified point.
px
- the X coordinate of the specified point to be measured against this Point2D
py
- the Y coordinate of the specified point to be measured against this Point2D
Point2D
and the specified point.
Returns the square of the distance from this Point2D
to a specified Point2D
.
pt
- the specified point to be measured against this Point2D
Point2D
to a specified Point2D
.
public double distance(double px, double py)
Returns the distance from this Point2D
to a specified point.
px
- the X coordinate of the specified point to be measured against this Point2D
py
- the Y coordinate of the specified point to be measured against this Point2D
Point2D
and a specified point.
Returns the distance from this Point2D
to a specified Point2D
.
pt
- the specified point to be measured against this Point2D
Point2D
and the specified Point2D
.
Creates a new object of the same class and with the same contents as this object.
clone
in class Object
OutOfMemoryError
- if there is not enough memory.
public int hashCode()
Returns the hashcode for this Point2D
.
Determines whether or not 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4