Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.newdawn.slick.geom
Class Polygon

    java.lang.Object
      org.newdawn.slick.geom.Shape
          org.newdawn.slick.geom.Polygon

All Implemented Interfaces:
  java.io.Serializable

    public class Polygon

extends Shape

A polygon implementation meeting the `Shape` contract.

Author:
  Mark
See Also:
  Serialized Form

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

### Polygon

    public Polygon(float[] points)

  Construct a new polygon with 3 or more points. This constructor will take the first set of points and copy them after the last set of points to create a closed shape.

  Parameters:
    `points` - An array of points in x, y order.

### Polygon

    public Polygon()

  Create an empty polygon

Method Detail

### setAllowDuplicatePoints

    public void setAllowDuplicatePoints(boolean allowDups)

  Indicate if duplicate points are allow

  Parameters:
    `allowDups` - True if duplicate points are allowed

### addPoint

    public void addPoint(float x,
                         float y)

  Add a point to the polygon

  Parameters:
    `x` - The x coordinate of the point
    `y` - The y coordinate of the point

### transform

    public Shape transform(Transform transform)

  Apply a transformation and return a new shape. This will not alter the current shape but will return the transformed shape.

  Specified by:
    `transform` in class `Shape`
  Parameters:
    `transform` - The transform to be applied
  Returns:
    The transformed shape.

### setX

    public void setX(float x)

  Description copied from class: `Shape`
  Set the x position of the left side this shape.

  Overrides:
    `setX` in class `Shape`
  Parameters:
    `x` - The new x position of the left side this shape.
  See Also:
    `Shape.setX(float)`

### setY

    public void setY(float y)

  Description copied from class: `Shape`
  Set the y position of the top of this shape.

  Overrides:
    `setY` in class `Shape`
  Parameters:
    `y` - The new y position of the top of this shape.
  See Also:
    `Shape.setY(float)`

### createPoints

    protected void createPoints()

  Description copied from class: `Shape`
  Subclasses implement this to create the points of the shape.

  Specified by:
    `createPoints` in class `Shape`
  See Also:
    `Shape.createPoints()`

### closed

    public boolean closed()

  Description copied from class: `Shape`
  True if this is a closed shape

  Overrides:
    `closed` in class `Shape`
  Returns:
    True if this is a closed shape
  See Also:
    `Shape.closed()`

### setClosed

    public void setClosed(boolean closed)

  Indicate if the polygon should be closed

  Parameters:
    `closed` - True if the polygon should be closed

### copy

    public Polygon copy()

  Provide a copy of this polygon

  Returns:
    A copy of this polygon

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 New Dawn Software. All Rights Reserved.