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.util.pathfinding.navmesh
Class NavMesh

    java.lang.Object
      org.newdawn.slick.util.pathfinding.navmesh.NavMesh

    public class NavMesh

extends java.lang.Object

A nav-mesh is a set of shapes that describe the navigation of a map. These shapes are linked together allow path finding but without the high resolution that tile maps require. This leads to fast path finding and potentially much more accurate map definition.

Author:
  kevin

Constructor Summary
`NavMesh()` Create a new empty mesh
`NavMesh(java.util.ArrayList spaces)` Create a new mesh with a set of spaces

Method Summary
`void` | `addSpace(Space space)` Add a single space to the mesh
`NavPath` | `findPath(float sx, float sy, float tx, float ty, boolean optimize)` Find a path from the source to the target coordinates
`Space` | `findSpace(float x, float y)` Find the space at a given location
`Space` | `getSpace(int index)` Get the space at a given index
`int` | `getSpaceCount()` Get the number of spaces that are in the mesh

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

Constructor Detail

### NavMesh

    public NavMesh()

  Create a new empty mesh

### NavMesh

    public NavMesh(java.util.ArrayList spaces)

  Create a new mesh with a set of spaces

  Parameters:
    `spaces` - The spaces included in the mesh

Method Detail

### getSpaceCount

    public int getSpaceCount()

  Get the number of spaces that are in the mesh

  Returns:
    The spaces in the mesh

### getSpace

    public Space getSpace(int index)

  Get the space at a given index

  Parameters:
    `index` - The index of the space to retrieve
  Returns:
    The space at the given index

### addSpace

    public void addSpace(Space space)

  Add a single space to the mesh

  Parameters:
    `space` - The space to be added

### findSpace

    public Space findSpace(float x,
                           float y)

  Find the space at a given location

  Parameters:
    `x` - The x coordinate at which to find the space
    `y` - The y coordinate at which to find the space
  Returns:
    The space at the given location

### findPath

    public NavPath findPath(float sx,
                            float sy,
                            float tx,
                            float ty,
                            boolean optimize)

  Find a path from the source to the target coordinates

  Parameters:
    `sx` - The x coordinate of the source location
    `sy` - The y coordinate of the source location
    `tx` - The x coordinate of the target location
    `ty` - The y coordinate of the target location
    `optimize` - True if paths should be optimized
  Returns:
    The path between the two spaces

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.