|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object acm.graphics.GPoint
public class GPoint
This class is a double-precision version of the Point
class
in java.awt
.
Constructor Summary | |
---|---|
GPoint()
GPoint at the origin (0, 0). |
|
GPoint(double x,
double y)
GPoint with the specified coordinates. |
|
GPoint(GPoint p)
GPoint from an existing one. |
|
GPoint(Point p)
GPoint from an existing AWT Point . |
Method Summary | |
---|---|
GPoint |
getLocation()
GPoint whose coordinates are the same as this one. |
double |
getX()
GPoint . |
double |
getY()
GPoint . |
void |
setLocation(double x,
double y)
GPoint to the specified x
and y values. |
void |
setLocation(GPoint p)
GPoint to that of an existing one. |
Point |
toPoint()
GPoint to the nearest integer-based Point . |
void |
translate(double dx,
double dy)
dx and
dy offsets. |
Constructor Detail |
---|
public GPoint()
GPoint
at the origin (0, 0).
Usage: | pt = new GPoint(); |
public GPoint(double x,
double y)
GPoint
with the specified coordinates.
Usage: | pt = new GPoint(x, y); | ||||
Parameters: |
|
public GPoint(GPoint p)
GPoint
from an existing one.
Usage: | pt = new GPoint(p); | ||
Parameter: |
|
public GPoint(Point p)
GPoint
from an existing AWT Point
.
Usage: | pt = new GPoint(p); | ||
Parameter: |
|
Method Detail |
---|
public GPoint getLocation()
GPoint
whose coordinates are the same as this one.
Usage: | p = pt.getLocation(); |
Returns: | A new point with the same coordinates |
public double getX()
GPoint
.
Usage: | x = pt.getX(); |
Returns: | The x coordinate of this GPoint
|
public double getY()
GPoint
.
Usage: | y = pt.getY(); |
Returns: | The y coordinate of this GPoint
|
public void setLocation(double x,
double y)
GPoint
to the specified x
and y
values.
Usage: | pt.setLocation(x, y); | ||||
Parameters: |
|
public void setLocation(GPoint p)
GPoint
to that of an existing one.
Usage: | pt.setLocation(p); | ||
Parameter: |
|
public Point toPoint()
GPoint
to the nearest integer-based Point
.
Usage: | size = dim.toPoint(); |
Returns: | The closest integer-based Point
|
public void translate(double dx,
double dy)
dx
and
dy
offsets.
Usage: | pt.translate(dx, dy); | ||||
Parameters: |
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |