#include <pathfinderastargeneric.h>
Classes | |
| class | AddNeighborFunctor |
| Functor passed to the IGetNeighbors functor. More... | |
| class | IGetNeighbors |
| Functor interface for getting the neighbor states of a given state. More... | |
Public Member Functions | |
| const PathResult | FindPath (const NODETYPE &start, const NODETYPE &goal, std::vector< NODETYPE > &finalpath, DESTCOST &destinationcost, GETNEIGHBORS &getneighbors) |
| Finds a path between two states. | |
| void | InitializeStep (const NODETYPE &start, const NODETYPE &goal, DESTCOST &destcost, GETNEIGHBORS &getneighbors) |
| Initializes the path finder for single stepping. | |
| const PathResult | Step () |
| Single steps the path finder. | |
| void | GetPath (std::vector< NODETYPE > &path) |
| Gets the current path. | |
This is a generic A * path finding class. Use the cached version of this class if state change costs mostly remain the same.
| NODETYPE | Defines a state of the pathfinder, typically an x,y coordinate for tile based games | |
| DESTCOST | A functor implementing IDestinationCost | |
| GETNEIGHBORS | A functor implementing IGetNeighbors | |
| COSTTYPE | The cost type of moving from state to state, typically a float or double |
| const PathResult Pathfinder::AStarGeneric< NODETYPE, DESTCOST, GETNEIGHBORS, COSTTYPE >::FindPath | ( | const NODETYPE & | start, | |
| const NODETYPE & | goal, | |||
| std::vector< NODETYPE > & | finalpath, | |||
| DESTCOST & | destinationcost, | |||
| GETNEIGHBORS & | getneighbors | |||
| ) | [inline] |
Finds a path between two states.
This method will block until a path from the start to the goal is found or all reachable nodes have been checked without finding a path.
| start | The starting state | |
| goal | The goal state | |
| [out] | finalpath | A vector of states from the starting state to the goal state |
| destinationcost | User supplied functor implementing IDestinationCost | |
| getneighbors | User supplied functor implementing IGetNeighbors |
| void Pathfinder::AStarGeneric< NODETYPE, DESTCOST, GETNEIGHBORS, COSTTYPE >::GetPath | ( | std::vector< NODETYPE > & | path | ) | [inline] |
Gets the current path.
This is usually called to get a complete path after Step returns PATH_FOUND, but it may be called at any step of the path finding, wheter a complete path has been found or not.
| [out] | path | A vector of states from the starting state to the current state |
| void Pathfinder::AStarGeneric< NODETYPE, DESTCOST, GETNEIGHBORS, COSTTYPE >::InitializeStep | ( | const NODETYPE & | start, | |
| const NODETYPE & | goal, | |||
| DESTCOST & | destcost, | |||
| GETNEIGHBORS & | getneighbors | |||
| ) | [inline] |
Initializes the path finder for single stepping.
| start | The starting state | |
| goal | The goal state | |
| destcost | User supplied functor IDestinationCost | |
| getneighbors | User supplied functor IGetNeighbors |
| const PathResult Pathfinder::AStarGeneric< NODETYPE, DESTCOST, GETNEIGHBORS, COSTTYPE >::Step | ( | ) | [inline] |
Single steps the path finder.
1.5.7.1