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 GeomUtil

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

    public class GeomUtil

extends java.lang.Object

A set of utilities to play with geometry

Author:
  kevin

Nested Class Summary
`class` | `GeomUtil.HitResult` A lightweigtht description of a intersection between a shape and line.

Field Summary
`float` | `EDGE_SCALE` The tolerance for determining direction change
`float` | `EPSILON` The tolerance for determining changes and steps
`GeomUtilListener` | `listener` The listener to notify of operations
`int` | `MAX_POINTS` The maximum number of points returned by an operation - prevents full lockups

Constructor Summary
`GeomUtil()`

Method Summary
`Line` | `getLine(Shape shape, float sx, float sy, int e)` Get a line between two points in a shape
`Line` | `getLine(Shape shape, int s, int e)` Get a line between two points in a shape
`GeomUtil.HitResult` | `intersect(Shape shape, Line line)` Intersect a line with a shape
`static int` | `rationalPoint(Shape shape, int p)` Rationalise a point in terms of a given shape
`void` | `setListener(GeomUtilListener listener)` Set the listener to be notified of geometry based operations
`Shape[]` | `subtract(Shape target, Shape missing)` Subtract one shape from another - note this is experimental and doesn't currently handle islands
`Shape[]` | `union(Shape target, Shape other)` Join to shapes together.

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

Field Detail

### EPSILON

    public float EPSILON

  The tolerance for determining changes and steps

### EDGE_SCALE

    public float EDGE_SCALE

  The tolerance for determining direction change

### MAX_POINTS

    public int MAX_POINTS

  The maximum number of points returned by an operation - prevents full lockups

### listener

    public GeomUtilListener listener

  The listener to notify of operations

Constructor Detail

### GeomUtil

    public GeomUtil()

Method Detail

### subtract

    public Shape[] subtract(Shape target,
                            Shape missing)

  Subtract one shape from another - note this is experimental and doesn't currently handle islands

  Parameters:
    `target` - The target to be subtracted from
    `missing` - The shape to subtract
  Returns:
    The newly created shapes

### setListener

    public void setListener(GeomUtilListener listener)

  Set the listener to be notified of geometry based operations

  Parameters:
    `listener` - The listener to be notified of geometry based operations

### union

    public Shape[] union(Shape target,
                         Shape other)

  Join to shapes together. Note that the shapes must be touching for this method to work.

  Parameters:
    `target` - The target shape to union with
    `other` - The additional shape to union
  Returns:
    The newly created shapes

### intersect

    public GeomUtil.HitResult intersect(Shape shape,
                                        Line line)

  Intersect a line with a shape

  Parameters:
    `shape` - The shape to compare
    `line` - The line to intersect against the shape
  Returns:
    The result describing the intersection or null if none

### rationalPoint

    public static int rationalPoint(Shape shape,
                                    int p)

  Rationalise a point in terms of a given shape

  Parameters:
    `shape` - The shape
    `p` - The index of the point
  Returns:
    The index that is rational for the shape

### getLine

    public Line getLine(Shape shape,
                        int s,
                        int e)

  Get a line between two points in a shape

  Parameters:
    `shape` - The shape
    `s` - The index of the start point
    `e` - The index of the end point
  Returns:
    The line between the two points

### getLine

    public Line getLine(Shape shape,
                        float sx,
                        float sy,
                        int e)

  Get a line between two points in a shape

  Parameters:
    `shape` - The shape
    `sx` - The x coordinate of the start point
    `sy` - The y coordinate of the start point
    `e` - The index of the end point
  Returns:
    The line between the two points

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.