Pathfinder::AStarTile4Dir< MOVECOST, DESTCOST, MOVEBLOCKED, COSTTYPE > Class Template Reference

A * path finder for 2d movement in 4 directions. More...

#include <pathfinderastartile4dir.h>

List of all members.

Public Member Functions

const PathResult FindPath (const std::pair< long, long > &start, const std::pair< long, long > &goal, std::vector< std::pair< long, long > > &finalpath, MOVECOST &movecost, DESTCOST &destinationcost)
 Finds a path from one x,y position to another.
const PathResult FindPath (const std::pair< long, long > &start, const std::pair< long, long > &goal, std::vector< std::pair< long, long > > &finalpath, MOVECOST &movecost, MOVEBLOCKED &moveblocked, DESTCOST &destinationcost)
 Finds a path from one x,y position to another.


Detailed Description

template<class MOVECOST, class DESTCOST, class MOVEBLOCKED, class COSTTYPE = double>
class Pathfinder::AStarTile4Dir< MOVECOST, DESTCOST, MOVEBLOCKED, COSTTYPE >

A * path finder for 2d movement in 4 directions.

This is an A * path finder for tile based games where movement is possible in 4 directions surrounding each tile. Up, down, left, and right.

Template Parameters:
MOVECOST A functor implementing IMoveCost
DESTCOST A functor implementing IDestinationCost
MOVEBLOCKED A functor implementing IMoveBlocked
COSTTYPE The cost type of moving from state to state, typically a float or double

Member Function Documentation

template<class MOVECOST , class DESTCOST , class MOVEBLOCKED , class COSTTYPE >
const PathResult Pathfinder::AStarTile4Dir< MOVECOST, DESTCOST, MOVEBLOCKED, COSTTYPE >::FindPath ( const std::pair< long, long > &  start,
const std::pair< long, long > &  goal,
std::vector< std::pair< long, long > > &  finalpath,
MOVECOST &  movecost,
MOVEBLOCKED &  moveblocked,
DESTCOST &  destinationcost 
) [inline]

Finds a path from one x,y position to another.

This method finds a path from one state to another and takes into consideration that any of the surrounding tiles may not be reachable. 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.

Parameters:
start The starting x,y position
goal The goal x,y position
[out] finalpath A vector of x,y positions from the starting position to the goal position
movecost A functor implementing IMoveCost
moveblocked A functor implementing IMoveBlocked
destinationcost A functor implementing IDestinationCost
Returns:
PATH_FOUND or PATH_NOTFOUND

template<class MOVECOST , class DESTCOST , class MOVEBLOCKED , class COSTTYPE >
const PathResult Pathfinder::AStarTile4Dir< MOVECOST, DESTCOST, MOVEBLOCKED, COSTTYPE >::FindPath ( const std::pair< long, long > &  start,
const std::pair< long, long > &  goal,
std::vector< std::pair< long, long > > &  finalpath,
MOVECOST &  movecost,
DESTCOST &  destinationcost 
) [inline]

Finds a path from one x,y position to another.

This method finds a path from one state to another and assumes that all 4 surrounding tiles are always reachable. 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.

Parameters:
start The starting x,y position
goal The goal x,y position
[out] finalpath A vector of x,y positions from the starting position to the goal position
movecost A functor implementing IMoveCost
destinationcost A functor implementing IDestinationCost
Returns:
PATH_FOUND or PATH_NOTFOUND


The documentation for this class was generated from the following file:

Generated on Mon Dec 29 19:08:11 2008 by  doxygen 1.5.7.1