PolyVox
0.3.0-dev
Open source voxel management library
|
The AStarPathfinder compute a path from one point in the volume to another. More...
#include <AStarPathfinder.h>
Public Member Functions | |
AStarPathfinder (const AStarPathfinderParams< VolumeType > ¶ms) | |
void | execute () |
The AStarPathfinder compute a path from one point in the volume to another.
A* is a well known pathfinding algorithm commonly used in computer games. It takes as input a pair of points in the world, and works out a path between them which avoids obstacles and adheres to other user defined criteria. The resulting path is usually the shortest possible, but a less optimal path can be exchanged for reduced computation time.
For an excellent overview of the A* algorithm please see Amit Patel's Game Programming page here: http://theory.stanford.edu/~amitp/GameProgramming/ Much of this class is based on the principles described in those pages.
Usage of this class if very strightforward. You create an instance of it by passing an instance of the AStarPathfinderParams structure to the constructor. The details of the AStarPathfinderParams and the options it provides are described in the documentation for that class.
Next you call the execute() function and wait for it to return. If a path is found then this is stored in the list which was set as the 'result' field of the AStarPathfinderParams. If a path cannot be found then an exception of type std::runtime_error is thrown.
Definition at line 164 of file AStarPathfinder.h.
PolyVox::AStarPathfinder< VolumeType >::AStarPathfinder | ( | const AStarPathfinderParams< VolumeType > & | params | ) |
Definition at line 49 of file AStarPathfinder.inl.
void PolyVox::AStarPathfinder< VolumeType >::execute | ( | ) |
Definition at line 55 of file AStarPathfinder.inl.