Finds a path in a Grid2D using the Breadth First Search algorithm.
More...
#include <BFS.h>
Finds a path in a Grid2D using the Breadth First Search algorithm.
Definition at line 38 of file BFS.h.
◆ BFS()
ime::BFS::BFS |
( |
const Vector2u & |
gridSize | ) |
|
|
explicit |
Initialize the algorithm.
- Parameters
-
gridSize | Size of the grid in tiles |
◆ backtrack()
std::stack< Index > ime::IPathFinderStrategy::backtrack |
( |
const std::vector< Node > & |
exploredNodes, |
|
|
const Index & |
target |
|
) |
| |
|
protectedinherited |
Generate path from the source to the target.
- Parameters
-
exploredNodes | Nodes explored after algorithm termination |
target | The index of the target tile in the grid |
- Returns
- The path from the source to the target tile if found, otherwise an empty path
◆ findPath()
std::stack< Index > ime::BFS::findPath |
( |
const Grid2D & |
grid, |
|
|
const Index & |
sourceTile, |
|
|
const Index & |
targetTile |
|
) |
| |
|
overridevirtual |
Generate a path from a source tile to a target tile in a grid.
- Parameters
-
grid | Grid to generate path in |
sourceTile | The position of the starting position in tiles |
targetTile | The position of the destination in tiles |
- Returns
- The path from the source to the destination if reachable, otherwise an empty path
Implements ime::IPathFinderStrategy.
◆ getType()
std::string ime::BFS::getType |
( |
| ) |
const |
|
overridevirtual |
Get the type of path finding algorithm.
- Returns
- The type of the path finding algorithm
Implements ime::IPathFinderStrategy.
The documentation for this class was generated from the following file: