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

## de.rico.engine.path
Class SearchGrid

    java.lang.Object
      de.rico.engine.path.SearchGrid

    public class SearchGrid

extends java.lang.Object

This class represents the grid that contains the walkable area of a scene. The grid is a two-dimensional plane in the XZ plane. It's center is located at the worlds origin (0f,0f,0f).

Author:
  Frank Bruns

Constructor Summary
`SearchGrid(int sceneWidth, int sceneLength, int gridNodeSize)` Creates a new search grid out of the specified walkable area image

Method Summary
`void` | `draw(javax.media.opengl.GL gl)` This method draws the search grid in the XZ plane at the height of -0.1
`GridNode` | `getGridNode(float x, float z)` Returns the grid node at the specified coordinates.
`GridNode` | `getGridNode(int id)` Returns the grid node by its id.
`GridNode[][]` | `getGridNodes()` Returns the 2 dimensional array of grid nodes representing the search grid.
`int` | `getGridNodeSize()` Returns the size of a grid node square
`java.util.List<GridNode>` | `getGridNodesList()` Returns a list representation of the grid nodes in the search grid.

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

Constructor Detail

### SearchGrid

    public SearchGrid(int sceneWidth,
                      int sceneLength,
                      int gridNodeSize)

  Creates a new search grid out of the specified walkable area image

  Parameters:
    `sceneWidth` - width of the scene (must be a power of 2)
    `sceneLength` - length of the scene (must be a power of 2)
    `gridNodeSize` - width and length for the square of a grid node (must be a power of 2)

Method Detail

### getGridNodeSize

    public int getGridNodeSize()

  Returns the size of a grid node square

  Returns:
    size of a grid node square

### getGridNodes

    public GridNode[][] getGridNodes()

  Returns the 2 dimensional array of grid nodes representing the search grid. The first dimension is the z dimension and the second one is the x dimension

  Returns:
    search grid nodes [z][x]

### getGridNodesList

    public java.util.List<GridNode> getGridNodesList()

  Returns a list representation of the grid nodes in the search grid.
  Note: The order of the nodes in the list is not sure to be the same as in the array representation.

  Returns:
    list representation of the grid nodes of the search grid

### getGridNode

    public GridNode getGridNode(float x,
                                float z)

  Returns the grid node at the specified coordinates. If none could be found it returns `null`.

  Parameters:
    `x` - x coordinate
    `z` - z coordinate
  Returns:
    grid node at the specified coordinates

### getGridNode

    public GridNode getGridNode(int id)

  Returns the grid node by its id. If none could be found it returns `null`.

  Parameters:
    `id` - id of the seeked grid node
  Returns:
    grid node that corresponds to the specified id

### draw

    public void draw(javax.media.opengl.GL gl)

  This method draws the search grid in the XZ plane at the height of -0.1

  Parameters:
    `gl` -

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