Polygon2D.Double, Polygon2D.Float_closed, _coordCount| Constructor and Description |
|---|
Double()
Create a new polygon with no coordinates
|
Double(double[] coords)
Create a new polygon with the
given vertices, in the format
[x0, y0, x1, y1, ...
|
Double(double x,
double y)
Create a new polygon with a single start point
|
Double(int size)
Create a new polygon with space for the
given number of vertices.
|
| Modifier and Type | Method and Description |
|---|---|
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(AffineTransform at)
Transform the polygon with the given transform.
|
void |
translate(double x,
double y)
Translate the polygon the given distance.
|
closePath, contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersects, reset, toStringpublic Double(int size)
public Double(double[] coords)
public Double()
public Double(double x,
double y)
public Rectangle2D getBounds2D()
getBounds2D in interface ShapegetBounds2D in class Polygon2Dpublic int getVertexCount()
getVertexCount in class Polygon2Dpublic double getX(int index)
getX in class Polygon2DIndexOutOfBoundsException - The index is out of bounds.public double getY(int index)
getY in class Polygon2DIndexOutOfBoundsException - The index is out of bounds.public void lineTo(double x,
double y)
public void moveTo(double x,
double y)
moveTo in class Polygon2DUnsupportedOperationException - The polygon already
has verticespublic void setX(int index,
double x)
setX in class Polygon2DIndexOutOfBoundsException - The index is out of bounds.public void setY(int index,
double y)
setY in class Polygon2DIndexOutOfBoundsException - The index is out of bounds.public void transform(AffineTransform at)
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.