|
Modifier and Type |
Method and Description |
|
clone |
java.lang.Object clone()
Creates a new object of the same class and with the
same contents as this object.
public java.lang.Object clone()
-
Description copied from class: java.awt.geom.Point2D
Creates a new object of the same class and with the
same contents as this object.
- Overrides:
clone in class java.lang.Object
- Returns:
- a clone of this instance.
- Throws:
java.lang.OutOfMemoryError - if there is not enough memory.- Since:
- 1.2
- See Also:
Cloneable
|
|
distance |
double distance(double px,
double py)
Returns the distance from this Point2D to
a specified point.
public double distance(double px,
double py)
-
Description copied from class: java.awt.geom.Point2D
Returns the distance from this Point2D to
a specified point.
- Parameters:
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
- Returns:
- the distance between this
Point2D
and a specified point. - Since:
- 1.2
|
|
distance |
double distance(java.awt.geom.Point2D pt)
Returns the distance from this Point2D to a
specified Point2D .
public double distance(java.awt.geom.Point2D pt)
-
Description copied from class: java.awt.geom.Point2D
Returns the distance from this Point2D to a
specified Point2D .
- Parameters:
pt - the specified point to be measured
against this Point2D
- Returns:
- the distance between this
Point2D and
the specified Point2D . - Since:
- 1.2
|
|
distanceSq |
double distanceSq(double px,
double py)
Returns the square of the distance from this
Point2D to a specified point.
public double distanceSq(double px,
double py)
-
Description copied from class: java.awt.geom.Point2D
Returns the square of the distance from this
Point2D to a specified point.
- Parameters:
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
- Returns:
- the square of the distance between this
Point2D and the specified point. - Since:
- 1.2
|
|
distanceSq |
double distanceSq(java.awt.geom.Point2D pt)
Returns the square of the distance from this
Point2D to a specified Point2D .
public double distanceSq(java.awt.geom.Point2D pt)
-
Description copied from class: java.awt.geom.Point2D
Returns the square of the distance from this
Point2D to a specified Point2D .
- Parameters:
pt - the specified point to be measured
against this Point2D
- Returns:
- the square of the distance between this
Point2D to a specified Point2D . - Since:
- 1.2
|
|
equals |
boolean equals(java.lang.Object obj)
Determines whether or not two points are equal.
public boolean equals(java.lang.Object obj)
-
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.
- Overrides:
equals in class java.awt.geom.Point2D
- Parameters:
obj - an object to be compared with this Point2D
- Returns:
true if the object to be compared is
an instance of Point2D and has
the same values; false otherwise.- See Also:
Object.hashCode() ,
HashMap
|
|
getLocation |
Returns the location of this point.
|
|
getX |
double getX()
Returns the X coordinate of this Point2D in
double precision.
public double getX()
-
Returns the X coordinate of this Point2D in
double precision.
- Specified by:
getX in class java.awt.geom.Point2D
- Returns:
- the X coordinate of this
Point2D . - Since:
- 1.2
|
|
getY |
double getY()
Returns the Y coordinate of this Point2D in
double precision.
public double getY()
-
Returns the Y coordinate of this Point2D in
double precision.
- Specified by:
getY in class java.awt.geom.Point2D
- Returns:
- the Y coordinate of this
Point2D . - Since:
- 1.2
|
|
hashCode |
int hashCode()
Returns the hashcode for this Point2D .
public int hashCode()
-
Description copied from class: java.awt.geom.Point2D
Returns the hashcode for this Point2D .
- Overrides:
hashCode in class java.lang.Object
- Returns:
- a hash code for this
Point2D . - See Also:
Object.equals(java.lang.Object) ,
System.identityHashCode(java.lang.Object)
|
|
move |
void move(int x,
int y)
Moves this point to the specified location in the
(x,y) coordinate plane.
public void move(int x,
int y)
-
Moves this point to the specified location in the
(x,y) coordinate plane. This method
is identical with setLocation(int, int) .
- Parameters:
x - the X coordinate of the new locationy - the Y coordinate of the new location- See Also:
Component.setLocation(int, int)
|
|
setLocation |
void setLocation(double x,
double y)
Sets the location of this point to the specified double coordinates.
public void setLocation(double x,
double y)
-
Sets the location of this point to the specified double coordinates.
The double values will be rounded to integer values.
Any number smaller than Integer.MIN_VALUE
will be reset to MIN_VALUE , and any number
larger than Integer.MAX_VALUE will be
reset to MAX_VALUE .
- Specified by:
setLocation in class java.awt.geom.Point2D
- Parameters:
x - the X coordinate of the new locationy - the Y coordinate of the new location- See Also:
getLocation()
|
|
setLocation |
void setLocation(int x,
int y)
Changes the point to have the specified location.
public void setLocation(int x,
int y)
-
Changes the point to have the specified location.
This method is included for completeness, to parallel the
setLocation method of Component .
Its behavior is identical with move(int, int) .
- Parameters:
x - the X coordinate of the new locationy - the Y coordinate of the new location- Since:
- 1.1
- See Also:
Component.setLocation(int, int) ,
getLocation() ,
move(int, int)
|
|
setLocation |
void setLocation(Point p)
Sets the location of the point to the specified location.
public void setLocation( Point p)
-
Sets the location of the point to the specified location.
This method is included for completeness, to parallel the
setLocation method of Component .
- Parameters:
p - a point, the new location for this point- Since:
- 1.1
- See Also:
Component.setLocation(java.awt.Point) ,
getLocation()
|
|
setLocation |
void setLocation(java.awt.geom.Point2D p)
Sets the location of this Point2D to the same
coordinates as the specified Point2D object.
public void setLocation(java.awt.geom.Point2D p)
-
Description copied from class: java.awt.geom.Point2D
Sets the location of this Point2D to the same
coordinates as the specified Point2D object.
- Parameters:
p - the specified Point2D to which to set
this Point2D - Since:
- 1.2
|
|
toString |
java.lang.String toString()
Returns a string representation of this point and its location
in the (x,y) coordinate space.
public java.lang.String toString()
-
Returns a string representation of this point and its location
in the (x,y) coordinate space. This method is
intended to be used only for debugging purposes, and the content
and format of the returned string may vary between implementations.
The returned string may be empty but may not be null .
- Overrides:
toString in class java.lang.Object
- Returns:
- a string representation of this point
|
|
translate |
void translate(int dx,
int dy)
Translates this point, at location (x,y) ,
by dx along the x axis and dy
along the y axis so that it now represents the point
(x+dx,y+dy) .
public void translate(int dx,
int dy)
-
Translates this point, at location (x,y) ,
by dx along the x axis and dy
along the y axis so that it now represents the point
(x+dx,y+dy) .
- Parameters:
dx - the distance to move this point
along the X axisdy - the distance to move this point
along the Y axis
|