public class Polygon extends Object
| Constructor and Description |
|---|
Polygon()
Constructor
|
Polygon(Collection<Point> vertices)
Constructor which creates a polygon from a collection of points
representing the vertices
|
Polygon(Point[] vertices)
Constructor which creates a polygon from an array of points representing
the vertices
|
| Modifier and Type | Method and Description |
|---|---|
void |
addVertex(Point vertex)
A method to add a vertex to the polygon
|
void |
addVertices(Collection<Point> vertices)
A method to add a collection of vertices to the polygon
|
void |
addVertices(Point[] vertices)
A method to add an array of vertices to the polygon
|
Rectangle |
getBoundingBox()
A method to get the Minimum Bounding Rectanngle of the polygon
|
Point[] |
getVertexArray()
A method to get an array of the vertices of the polygon
|
ArrayList<Point> |
getVertices()
A method to get an ArrayList of the vertices of the polygon
|
boolean |
isValid()
A method to check the validity of the polygon.
|
String |
toString() |
public Polygon()
public Polygon(Collection<Point> vertices)
vertices - -
collection of points representing the vertices of the polygon
to be createdpublic Polygon(Point[] vertices)
vertices - -
an array of points representing the vertices of the polygon to
be createdpublic void addVertex(Point vertex)
vertex - -
The vertex to be added to the polygonpublic void addVertices(Collection<Point> vertices)
vertices - -
a collection of vertices to be added to the polygonpublic void addVertices(Point[] vertices)
vertices - -
an array of vertices to be added to the polygonpublic ArrayList<Point> getVertices()
public Point[] getVertexArray()
public Rectangle getBoundingBox()
public boolean isValid()
Copyright © 2014. All Rights Reserved.