![]() |
Plasma Engine
2.0
|
Implements a directed breadth-first search through a graph (A*). More...
#include <GraphSearch.h>
Classes | |
struct | PathResultData |
FindPath() and FindClosest() return an array of these objects as the path result. More... | |
Public Types | |
using | IsSearchedObjectCallback = bool (*)(plInt64 iStartNodeIndex, const PathStateType& StartState) |
Used by FindClosest() to query whether the currently visited node fulfills the termination criteria. | |
Public Member Functions | |
void | SetPathStateGenerator (plPathStateGenerator< PathStateType > *pStateGenerator) |
Sets the plPathStateGenerator that should be used by this plPathSearch object. | |
plResult | FindPath (plInt64 iStartNodeIndex, const PathStateType &StartState, plInt64 iTargetNodeIndex, plDeque< PathResultData > &out_Path, float fMaxPathCost=plMath::Infinity< float >()) |
Searches for a path that starts at the graph node iStartNodeIndex with the start state StartState and shall terminate when the graph node iTargetNodeIndex was reached. | |
plResult | FindClosest (plInt64 iStartNodeIndex, const PathStateType &StartState, IsSearchedObjectCallback Callback, plDeque< PathResultData > &out_Path, float fMaxPathCost=plMath::Infinity< float >()) |
Searches for a path that starts at the graph node iStartNodeIndex with the start state StartState and shall terminate when a graph node is reached for which Callback return true. | |
void | AddPathNode (plInt64 iNodeIndex, const PathStateType &NewState) |
Needs to be called by the used plPathStateGenerator to add nodes to evaluate. | |
Implements a directed breadth-first search through a graph (A*).
You can search for a path to a specific location using FindPath() or to the closest node that fulfills some arbitrary criteria using FindClosest().
PathStateType must be derived from plPathState and can be used for keeping track of certain state along a path and to modify the path search dynamically.
plResult plPathSearch< PathStateType >::FindClosest | ( | plInt64 | iStartNodeIndex, |
const PathStateType & | StartState, | ||
IsSearchedObjectCallback | Callback, | ||
plDeque< PathResultData > & | out_Path, | ||
float | fMaxPathCost = plMath::Infinity<float>() ) |
Searches for a path that starts at the graph node iStartNodeIndex with the start state StartState and shall terminate when a graph node is reached for which Callback return true.
Returns PL_FAILURE if no path could be found. Returns the path result as a list of PathResultData objects in out_Path.
The path search is stopped (and thus fails) if the path reaches costs of fMaxPathCost or higher.
plResult plPathSearch< PathStateType >::FindPath | ( | plInt64 | iStartNodeIndex, |
const PathStateType & | StartState, | ||
plInt64 | iTargetNodeIndex, | ||
plDeque< PathResultData > & | out_Path, | ||
float | fMaxPathCost = plMath::Infinity<float>() ) |
Searches for a path that starts at the graph node iStartNodeIndex with the start state StartState and shall terminate when the graph node iTargetNodeIndex was reached.
Returns PL_FAILURE if no path could be found. Returns the path result as a list of PathResultData objects in out_Path.
The path search is stopped (and thus fails) if the path reaches costs of fMaxPathCost or higher.