public class Polygon extends Shape
Shape
contract.boundingCircleRadius, center, maxX, maxY, minX, minY, points, pointsDirty, trianglesDirty, tris, x, y
Constructor and Description |
---|
Polygon()
Create an empty polygon
|
Polygon(float[] points)
Construct a new polygon with 3 or more points.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(float x,
float y)
Add a point to the polygon
|
boolean |
closed()
True if this is a closed shape
|
Polygon |
copy()
Provide a copy of this polygon
|
protected void |
createPoints()
Subclasses implement this to create the points of the shape.
|
void |
setAllowDuplicatePoints(boolean allowDups)
Indicate if duplicate points are allow
|
void |
setClosed(boolean closed)
Indicate if the polygon should be closed
|
void |
setX(float x)
Set the x position of the left side this shape.
|
void |
setY(float y)
Set the y position of the top of this shape.
|
Shape |
transform(Transform transform)
Apply a transformation and return a new shape.
|
calculateRadius, calculateTriangles, checkPoints, contains, contains, findCenter, getBoundingCircleRadius, getCenter, getCenterX, getCenterY, getHeight, getLocation, getMaxX, getMaxY, getMinX, getMinY, getNormal, getPoint, getPointCount, getPoints, getTriangles, getWidth, getX, getY, hasVertex, includes, increaseTriangulation, indexOf, intersects, preCache, prune, setCenterX, setCenterY, setLocation, setLocation, subtract, union
public Polygon(float[] points)
points
- An array of points in x, y order.public Polygon()
public void setAllowDuplicatePoints(boolean allowDups)
allowDups
- True if duplicate points are allowedpublic void addPoint(float x, float y)
x
- The x coordinate of the pointy
- The y coordinate of the pointpublic Shape transform(Transform transform)
public void setX(float x)
Shape
public void setY(float y)
Shape
protected void createPoints()
Shape
createPoints
in class Shape
public boolean closed()
Shape
public void setClosed(boolean closed)
closed
- True if the polygon should be closedpublic Polygon copy()