Class Overview
The Float
class defines a point specified in float
precision.
Summary
Fields |
public
float |
x |
The X coordinate of this Point2D . |
public
float |
y |
The Y coordinate of this Point2D . |
Public Constructors |
|
Point2D.Float()
Constructs and initializes a Point2D with
coordinates (0, 0).
|
|
Point2D.Float(float x, float y)
Constructs and initializes a Point2D with
the specified coordinates.
|
Public Methods |
double
|
getX()
Returns the X coordinate of this Point2D in
double precision.
|
double
|
getY()
Returns the Y coordinate of this Point2D in
double precision.
|
void
|
setLocation(double x, double y)
Sets the location of this Point2D to the
specified double coordinates.
|
void
|
setLocation(float x, float y)
Sets the location of this Point2D to the
specified float coordinates.
|
String
|
toString()
Returns a String that represents the value
of this Point2D .
|
[Expand]
Inherited Methods |
From class
java.awt.geom.Point2D
Object
|
clone()
Creates a new object of the same class and with the
same contents as this object.
|
double
|
distance(Point2D pt)
Returns the distance from this Point2D to a
specified Point2D .
|
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 Point2D to
a specified point.
|
double
|
distanceSq(Point2D pt)
Returns the square of the distance from this
Point2D to a specified Point2D .
|
double
|
distanceSq(double px, double py)
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.
|
boolean
|
equals(Object obj)
Determines whether or not two points are equal.
|
abstract
double
|
getX()
Returns the X coordinate of this Point2D in
double precision.
|
abstract
double
|
getY()
Returns the Y coordinate of this Point2D in
double precision.
|
int
|
hashCode()
Returns the hashcode for this Point2D .
|
abstract
void
|
setLocation(double x, double y)
Sets the location of this Point2D to the
specified double coordinates.
|
void
|
setLocation(Point2D p)
Sets the location of this Point2D to the same
coordinates as the specified Point2D object.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
Fields
public
float
x
The X coordinate of this Point2D
.
public
float
y
The Y coordinate of this Point2D
.
Public Constructors
public
Point2D.Float
()
Constructs and initializes a Point2D
with
coordinates (0, 0).
public
Point2D.Float
(float x, float y)
Constructs and initializes a Point2D
with
the specified coordinates.
Parameters
x
| the X coordinate of the newly
constructed Point2D |
y
| the Y coordinate of the newly
constructed Point2D |
Public Methods
public
double
getX
()
Returns the X coordinate of this Point2D
in
double
precision.
Returns
- the X coordinate of this
Point2D
.
public
double
getY
()
Returns the Y coordinate of this Point2D
in
double
precision.
Returns
- the Y coordinate of this
Point2D
.
public
void
setLocation
(double x, double y)
Sets the location of this Point2D
to the
specified double
coordinates.
Parameters
x
| the new X coordinate of this Point2D |
y
| the new Y coordinate of this Point2D |
public
void
setLocation
(float x, float y)
Sets the location of this Point2D
to the
specified float
coordinates.
Parameters
x
| the new X coordinate of this Point2D |
y
| the new Y coordinate of this Point2D |
public
String
toString
()
Returns a String
that represents the value
of this Point2D
.
Returns
- a string representation of this
Point2D
.