|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.util.java2d.Polygon2D
diva.util.java2d.Polygon2D.Double
public static class Polygon2D.Double
The concrete Polygon class that stores coordinates internally as doubles.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class diva.util.java2d.Polygon2D |
---|
Polygon2D.Double, Polygon2D.Float |
Field Summary | |
---|---|
(package private) double[] |
_coords
The coordinates |
Fields inherited from class diva.util.java2d.Polygon2D |
---|
_closed, _coordCount |
Constructor Summary | |
---|---|
Polygon2D.Double()
Create a new polygon with no coordinates |
|
Polygon2D.Double(double[] coords)
Create a new polygon with the given vertices, in the format [x0, y0, x1, y1, ... ]. |
|
Polygon2D.Double(double x,
double y)
Create a new polygon with a single start point |
|
Polygon2D.Double(int size)
Create a new polygon with space for the given number of vertices. |
Method Summary | |
---|---|
java.awt.geom.Rectangle2D |
getBounds2D()
Get the floating-point bounds of the polygon. |
int |
getVertexCount()
Get the number of vertices |
double |
getX(int index)
Get the given X-coordinate |
double |
getY(int index)
Get the given Y-coordinate |
void |
lineTo(double x,
double y)
Add a new vertex to the end of the line. |
void |
moveTo(double x,
double y)
Move the start point of the vertex to the given position. |
void |
setX(int index,
double x)
Set the given X-coordinate. |
void |
setY(int index,
double y)
Set the given Y-coordinate |
void |
transform(java.awt.geom.AffineTransform at)
Transform the polygon with the given transform. |
void |
translate(double x,
double y)
Translate the polygon the given distance. |
Methods inherited from class diva.util.java2d.Polygon2D |
---|
closePath, contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersects, reset, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
double[] _coords
Constructor Detail |
---|
public Polygon2D.Double(int size)
public Polygon2D.Double(double[] coords)
public Polygon2D.Double()
public Polygon2D.Double(double x, double y)
Method Detail |
---|
public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface java.awt.Shape
getBounds2D
in class Polygon2D
public int getVertexCount()
getVertexCount
in class Polygon2D
public double getX(int index)
getX
in class Polygon2D
java.lang.IndexOutOfBoundsException
- The index is out of bounds.public double getY(int index)
getY
in class Polygon2D
java.lang.IndexOutOfBoundsException
- The index is out of bounds.public void lineTo(double x, double y)
lineTo
in class Polygon2D
public void moveTo(double x, double y)
moveTo
in class Polygon2D
java.lang.UnsupportedOperationException
- The polygon already
has verticespublic void setX(int index, double x)
setX
in class Polygon2D
java.lang.IndexOutOfBoundsException
- The index is out of bounds.public void setY(int index, double y)
setY
in class Polygon2D
java.lang.IndexOutOfBoundsException
- The index is out of bounds.public void transform(java.awt.geom.AffineTransform at)
transform
in class Polygon2D
public void translate(double x, double y)
translate
in class Polygon2D
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |