|
void | ComputeRows (std::vector< Row > &rows, const Grid< NavcellData > &terrain, pass_class_t passClass, bool transpose, bool mirror) |
| Compute the cached obstruction/jump points for each cell, in a single direction. More...
|
|
void | reset (const Grid< NavcellData > *terrain, pass_class_t passClass) |
|
size_t | GetMemoryUsage () const |
|
int | GetJumpPointRight (int i, int j, const PathGoal &goal) const |
| Returns the next jump point (or goal point) to explore, at (ip, j) where i < ip. More...
|
|
int | GetJumpPointLeft (int i, int j, const PathGoal &goal) const |
|
int | GetJumpPointUp (int i, int j, const PathGoal &goal) const |
|
int | GetJumpPointDown (int i, int j, const PathGoal &goal) const |
|
Jump point cache.
The JPS algorithm wants to efficiently either find the first jump point in some direction from some cell (not counting the cell itself), if it is reachable without crossing any impassable cells; or know that there is no such reachable jump point. The jump point is always on a passable cell. We cache that data to allow fast lookups, which helps performance significantly (especially on sparse maps). Recalculation might be expensive but the underlying passability data changes relatively rarely.
To allow the algorithm to detect goal cells, we want to treat them as jump points too. (That means the algorithm will push those cells onto its open queue, and will eventually pop a goal cell and realise it's done.) (Goals might be circles/squares/etc, not just a single cell.) But the goal generally changes for every path request, so we can't cache it like the normal jump points. Instead, if there's no jump point from some cell then we'll cache the first impassable cell as an 'obstruction jump point' (with a flag to distinguish from a real jump point), and then the caller can test whether the goal includes a cell that's closer than the first (obstruction or real) jump point, and treat the goal cell as a jump point in that case.
We only ever need to find the jump point relative to a passable cell; the cache is allowed to return bogus values for impassable cells.