|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.geom.Shape org.newdawn.slick.geom.Polygon
public class Polygon
A polygon implementation meeting the Shape
contract.
Field Summary |
---|
Fields inherited from class org.newdawn.slick.geom.Shape |
---|
boundingCircleRadius, center, maxX, maxY, minX, minY, points, pointsDirty, trianglesDirty, tris, x, y |
Constructor Summary | |
---|---|
Polygon()
Create an empty polygon |
|
Polygon(float[] points)
Construct a new polygon with 3 or more points. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.newdawn.slick.geom.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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Polygon(float[] points)
points
- An array of points in x, y order.public Polygon()
Method Detail |
---|
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)
transform
in class Shape
transform
- The transform to be applied
public void setX(float x)
Shape
setX
in class Shape
x
- The new x position of the left side this shape.Shape.setX(float)
public void setY(float y)
Shape
setY
in class Shape
y
- The new y position of the top of this shape.Shape.setY(float)
protected void createPoints()
Shape
createPoints
in class Shape
Shape.createPoints()
public boolean closed()
Shape
closed
in class Shape
Shape.closed()
public void setClosed(boolean closed)
closed
- True if the polygon should be closedpublic Polygon copy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |