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

## edu.eside.flingbox.bodies
Class Polygon

    java.lang.Object
      edu.eside.flingbox.bodies.Body
          edu.eside.flingbox.bodies.Polygon

All Implemented Interfaces:
  PhysicBody.OnMovementListener, XmlExporter.XmlSerializable, XmlImporter.XmlParseable

    public final class Polygon

extends Body
implements PhysicBody.OnMovementListener, XmlExporter.XmlSerializable, XmlImporter.XmlParseable

Polygon is a general class which handles the physics and render instances of a polygonal Body.

Constructor Summary
`Polygon()`
`Polygon(Vector2D[] polygonPoints)` Constructor for a Polygon

Method Summary
`Vector2D[]` | `getPoints()`
`short` | `getPointsCount()`
`void` | `onMovement(Vector2D position, float rotation)` Called when movement occurs.
`boolean` | `readXml(XmlPullParser parser)`
`void` | `setPoints(Vector2D[] points, Vector2D centroid)`
`void` | `setRandomColor()` Sets random color to polygon
`boolean` | `writeXml(XmlSerializer serializer)` XML Writter

Methods inherited from class edu.eside.flingbox.bodies.Body
`getPhysics, getRender`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Polygon

    public Polygon()

### Polygon

    public Polygon(Vector2D[] polygonPoints)
            throws java.lang.IllegalArgumentException

  Constructor for a Polygon

  Parameters:
    `polygonPoints` - Array of Polygon's point, this is stored and modified
  Throws:
    `java.lang.IllegalArgumentException` - If not enough points

Method Detail

### getPoints

    public Vector2D[] getPoints()

  Returns:
    Polygon points

### setPoints

    public void setPoints(Vector2D[] points,
                          Vector2D centroid)

### getPointsCount

    public short getPointsCount()

  Returns:
    Polygons total points.

### setRandomColor

    public void setRandomColor()

  Sets random color to polygon

### onMovement

    public void onMovement(Vector2D position,
                           float rotation)

  Called when movement occurs.

  Specified by:
    `onMovement` in interface `PhysicBody.OnMovementListener`
  Parameters:
    `position` - new body's position

### writeXml

    public boolean writeXml(XmlSerializer serializer)

  XML Writter

  Specified by:
    `writeXml` in interface `XmlExporter.XmlSerializable`

### readXml

    public boolean readXml(XmlPullParser parser)
                    throws XmlPullParserException,
                           java.io.IOException,
                           InvalidXmlException

  Specified by:
    `readXml` in interface `XmlImporter.XmlParseable`
  Throws:
    `XmlPullParserException`
    `java.io.IOException`
    `InvalidXmlException`

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