|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectGlobalNavigation.Grid
public class Grid
Grid for path planning.
| Nested Class Summary | |
|---|---|
class |
Grid.Cell
|
protected class |
Grid.GridIterator
An iterator over cell. |
| Field Summary | |
|---|---|
protected Grid.Cell[][] |
cell
The grid cells. |
protected int |
cols
Number of cols in the grid. |
protected double |
resolution
Grid resolution. |
protected int |
rows
Number of rows in the grid. |
protected java.awt.geom.Rectangle2D.Double |
worldBounds
World boundary. |
| Constructor Summary | |
|---|---|
Grid(java.awt.geom.Rectangle2D.Double worldBounds,
double resolution)
Create a new grid. |
|
| Method Summary | |
|---|---|
protected java.util.List<Grid.Cell> |
collectNeighbors(Grid.Cell c,
java.util.List<Grid.Cell> neighbors)
Collect all the (Manhattan) neighbors of cell. |
double |
computeShortestPaths(java.awt.geom.Point2D.Double goalPoint)
Compute and cache the shortest (Manhattan) paths (BFS) from each cell in the grid to the cell containing goalPoint. |
Grid.Cell |
getCell(java.awt.geom.Point2D.Double point)
Get the cell containing point, or null if out of
bounds. |
java.util.Iterator<Grid.Cell> |
iterator()
Get a Grid.GridIterator over cell. |
int |
markObstacle(PolygonObstacle obstacle)
Mark all the Grid.Cell that PolygonObstacle.intersects(double, double, double, double)
obstacle not Grid.Cell.free. |
int |
numCells()
Get the number of cells in this Grid. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.awt.geom.Rectangle2D.Double worldBounds
World boundary.
protected double resolution
Grid resolution.
protected int rows
Number of rows in the grid.
protected int cols
Number of cols in the grid.
protected Grid.Cell[][] cell
The grid cells.
| Constructor Detail |
|---|
public Grid(java.awt.geom.Rectangle2D.Double worldBounds,
double resolution)
Create a new grid.
worldBounds - the world boundaryresolution - the grid resolution| Method Detail |
|---|
public int markObstacle(PolygonObstacle obstacle)
Mark all the Grid.Cell that PolygonObstacle.intersects(double, double, double, double)
obstacle not Grid.Cell.free.
obstacle - the obstacle
public double computeShortestPaths(java.awt.geom.Point2D.Double goalPoint)
Compute and cache the shortest (Manhattan) paths (BFS) from each cell
in the grid to the cell containing goalPoint.
Only Grid.Cell.free cells are traversed.
goalPoint - the goal point
goalPoint is out
of bounds
protected java.util.List<Grid.Cell> collectNeighbors(Grid.Cell c,
java.util.List<Grid.Cell> neighbors)
Collect all the (Manhattan) neighbors of cell.
c - the cellneighbors - the neighbors are collected here
neighborspublic Grid.Cell getCell(java.awt.geom.Point2D.Double point)
Get the cell containing point, or null if out of
bounds.
point - the query point
point, or null if out of boundspublic java.util.Iterator<Grid.Cell> iterator()
Get a Grid.GridIterator over cell.
iterator in interface java.lang.Iterable<Grid.Cell>public int numCells()
Get the number of cells in this Grid.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||