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 BasicTriangulator

    java.lang.Object
      org.newdawn.slick.geom.BasicTriangulator

All Implemented Interfaces:
  java.io.Serializable, Triangulator

    public class BasicTriangulator

extends java.lang.Object
implements Triangulator

Triangulates a polygon into triangles - duh. Doesn't handle holes in polys

Author:
  Based on Public Source from FlipCode
See Also:
  Serialized Form

Constructor Summary
`BasicTriangulator()` Create a new triangulator

Method Summary
`void` | `addPolyPoint(float x, float y)` Add a point describing the polygon to be triangulated
`float[]` | `getPolyPoint(int index)` Get the coordinates of the point at the specified index
`int` | `getPolyPointCount()` Get the number of points in the polygon
`int` | `getTriangleCount()` Get a count of the number of triangles produced
`float[]` | `getTrianglePoint(int tri, int i)` Get a point on a specified generated triangle
`void` | `startHole()` Start a hole in the polygon
`boolean` | `triangulate()` Cause the triangulator to split the polygon

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

Constructor Detail

### BasicTriangulator

    public BasicTriangulator()

  Create a new triangulator

Method Detail

### addPolyPoint

    public void addPolyPoint(float x,
                             float y)

  Add a point describing the polygon to be triangulated

  Specified by:
    `addPolyPoint` in interface `Triangulator`
  Parameters:
    `x` - The x coordinate of the point
    `y` - the y coordinate of the point

### getPolyPointCount

    public int getPolyPointCount()

  Get the number of points in the polygon

  Returns:
    The number of points in the polygon

### getPolyPoint

    public float[] getPolyPoint(int index)

  Get the coordinates of the point at the specified index

  Parameters:
    `index` - The index of the point to retrieve
  Returns:
    The oordinates of the point at the specified index

### triangulate

    public boolean triangulate()

  Cause the triangulator to split the polygon

  Specified by:
    `triangulate` in interface `Triangulator`
  Returns:
    True if we managed the task

### getTriangleCount

    public int getTriangleCount()

  Get a count of the number of triangles produced

  Specified by:
    `getTriangleCount` in interface `Triangulator`
  Returns:
    The number of triangles produced

### getTrianglePoint

    public float[] getTrianglePoint(int tri,
                                    int i)

  Get a point on a specified generated triangle

  Specified by:
    `getTrianglePoint` in interface `Triangulator`
  Parameters:
    `tri` - The index of the triangle to interegate
    `i` - The index of the point within the triangle to retrieve (0 - 2)
  Returns:
    The x,y coordinate pair for the point

### startHole

    public void startHole()

  Description copied from interface: `Triangulator`
  Start a hole in the polygon

  Specified by:
    `startHole` in interface `Triangulator`
  See Also:
    `Triangulator.startHole()`

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.