org.newdawn.slick.geom
Class MannTriangulator

java.lang.Object
  extended by org.newdawn.slick.geom.MannTriangulator
All Implemented Interfaces:
java.io.Serializable, Triangulator

public class MannTriangulator
extends java.lang.Object
implements Triangulator

A 2D Triangulator. Graciously made available by the man(n) himself.

Author:
Matthias Mann
See Also:
Serialized Form

Nested Class Summary
protected  class MannTriangulator.PointBag
          A bag/pool of point objects
 
Field Summary
protected  MannTriangulator.PointBag contour
          The outer countour of the shape
protected  MannTriangulator.PointBag holes
          The holes defined in the polygon
 
Constructor Summary
MannTriangulator()
          Creates a new instance of Triangulator0
 
Method Summary
 void addPolyPoint(float x, float y)
          Add a point that forms part of the outer 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 reset()
          Reset the internal state of the triangulator
 void startHole()
          Begin adding a hole to the polygon
 boolean triangulate()
          Run the triangulation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contour

protected MannTriangulator.PointBag contour
The outer countour of the shape


holes

protected MannTriangulator.PointBag holes
The holes defined in the polygon

Constructor Detail

MannTriangulator

public MannTriangulator()
Creates a new instance of Triangulator0

Method Detail

addPolyPoint

public void addPolyPoint(float x,
                         float y)
Description copied from interface: Triangulator
Add a point that forms part of the outer polygon

Specified by:
addPolyPoint in interface Triangulator
Parameters:
x - The x coordinate of the point
y - The y coordiante of the point
See Also:
Triangulator.addPolyPoint(float, float)

reset

public void reset()
Reset the internal state of the triangulator


startHole

public void startHole()
Begin adding a hole to the polygon

Specified by:
startHole in interface Triangulator

triangulate

public boolean triangulate()
Description copied from interface: Triangulator
Run the triangulation

Specified by:
triangulate in interface Triangulator
Returns:
True if successful

getTriangleCount

public int getTriangleCount()
Description copied from interface: Triangulator
Get a count of the number of triangles produced

Specified by:
getTriangleCount in interface Triangulator
Returns:
The number of triangles produced
See Also:
Triangulator.getTriangleCount()

getTrianglePoint

public float[] getTrianglePoint(int tri,
                                int i)
Description copied from interface: Triangulator
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
See Also:
Triangulator.getTrianglePoint(int, int)


Copyright © 2006 New Dawn Software. All Rights Reserved.