HOG2
HPAStar.h
Go to the documentation of this file.
1 /*
2  * hpaStar.h
3  *
4  * Created by Renee Jansen on 05/16/06
5  *
6  */
7 
8 #ifndef HPASTAR_H
9 #define HPASTAR_H
10 
11 #include "SearchAlgorithm.h"
12 #include "ClusterAbstraction.h"
13 
21 class hpaStar : public SearchAlgorithm {
22 public:
23 
24  // From HPA* original code - smoothwizard.h
25  typedef enum {
30  NE,
31  SE,
32  SW,
34 
35  typedef enum {
37  END,
39 
40  hpaStar();
41  virtual ~hpaStar(){}
42 
43  virtual path* GetPath(GraphAbstraction *aMap, node* from, node* to, reservationProvider *rp = 0);
44 
45  virtual const char *GetName() { return algName; }
46  void setUpSearch(node* from, node* to);
47  path* findAbstractPath(node* from, node* to);
48  path* findMapPath(path* abPath,node* from,node* to);
49  void cleanUpSearch();
50  path* smoothPath(path* p);
51  void setSmoothing(bool smooth);
52  void setPartialPathLimit(int limit) { partialLimit = limit;
53  sprintf(algName,"HPA*(%d)",partialLimit); }
63  void setSmoothType(SmoothType s) { smType = s; }
64 
65  // Ensure that the abstraction is a ClusterAbstraction
66  void setAbstraction(ClusterAbstraction* _m) { m = _m; }
67 
68 protected:
69  char algName[30];
74  std::vector<node*> lookup;
75  path* nextPathNode(node* n, int dir);
76  node* getNextNode(int x, int y, int dir);
77  bool smoothing;
79  bool nextInLookup(int last, int curr, std::vector<node*> lookup);
80  int backTwoNodes(int i, std::vector<node*> lookup);
81  void findMinMax(path* p);
82  int minx;
83  int maxx;
84  int miny;
85  int maxy;
86 };
87 
88 #endif
hpaStar::SOUTH
@ SOUTH
Definition: HPAStar.h:28
hpaStar::GetPath
virtual path * GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp=0)
Returns the HPA* path between from and to.
Definition: HPAStar.cpp:45
GraphAbstraction
A generic class for basic operations on Graph abstractions.
Definition: GraphAbstraction.h:63
hpaStar::NORTH
@ NORTH
Definition: HPAStar.h:26
hpaStar::SE
@ SE
Definition: HPAStar.h:31
hpaStar::nextInLookup
bool nextInLookup(int last, int curr, std::vector< node * > lookup)
find out whether last is the next 'real' index in the lookup table after curr.
Definition: HPAStar.cpp:453
hpaStar::nextPathNode
path * nextPathNode(node *n, int dir)
shoot a ray in direction dir and see if you hit the path Return the better path if you find it; 0 if ...
Definition: HPAStar.cpp:473
hpaStar::m
ClusterAbstraction * m
Definition: HPAStar.h:70
ClusterAbstraction
Cluster abstraction for HPA* algorithm as described in (Botea,Mueller,Schaeffer 2004).
Definition: ClusterAbstraction.h:122
hpaStar
HPA* algorithm as described in (Botea,Mueller,Schaeffer 2004).
Definition: HPAStar.h:21
hpaStar::TWO_BACK
@ TWO_BACK
Definition: HPAStar.h:38
SearchAlgorithm.h
hpaStar::findMinMax
void findMinMax(path *p)
Definition: HPAStar.cpp:550
hpaStar::Direction
Direction
Definition: HPAStar.h:25
hpaStar::algName
char algName[30]
Definition: HPAStar.h:69
hpaStar::smType
SmoothType smType
Definition: HPAStar.h:78
hpaStar::smoothPath
path * smoothPath(path *p)
from HPA* smoothwizard.cpp
Definition: HPAStar.cpp:299
hpaStar::minx
int minx
Definition: HPAStar.h:82
hpaStar::getNextNode
node * getNextNode(int x, int y, int dir)
get the next node from map coordinates (x,y) in direction dir.
Definition: HPAStar.cpp:514
hpaStar::setPartialPathLimit
void setPartialPathLimit(int limit)
Definition: HPAStar.h:52
hpaStar::BEGIN
@ BEGIN
Definition: HPAStar.h:36
hpaStar::smoothing
bool smoothing
Definition: HPAStar.h:77
hpaStar::setAbstraction
void setAbstraction(ClusterAbstraction *_m)
Definition: HPAStar.h:66
ClusterAbstraction.h
hpaStar::fromnum
node * fromnum
Definition: HPAStar.h:72
hpaStar::maxx
int maxx
Definition: HPAStar.h:83
hpaStar::NE
@ NE
Definition: HPAStar.h:30
hpaStar::hpaStar
hpaStar()
Definition: HPAStar.cpp:19
hpaStar::setSmoothType
void setSmoothType(SmoothType s)
Set the smoothing type.
Definition: HPAStar.h:63
hpaStar::partialLimit
int partialLimit
Definition: HPAStar.h:71
hpaStar::backTwoNodes
int backTwoNodes(int i, std::vector< node * > lookup)
Find the index of the node two nodes back in the path.
Definition: HPAStar.cpp:434
hpaStar::GetName
virtual const char * GetName()
Definition: HPAStar.h:45
hpaStar::findAbstractPath
path * findAbstractPath(node *from, node *to)
Definition: HPAStar.cpp:172
hpaStar::findMapPath
path * findMapPath(path *abPath, node *from, node *to)
Definition: HPAStar.cpp:198
hpaStar::setSmoothing
void setSmoothing(bool smooth)
Set whether we want to do path smoothing.
Definition: HPAStar.cpp:33
hpaStar::WEST
@ WEST
Definition: HPAStar.h:29
hpaStar::setUpSearch
void setUpSearch(node *from, node *to)
Definition: HPAStar.cpp:148
hpaStar::cleanUpSearch
void cleanUpSearch()
Remove the start & goal nodes from the Graph.
Definition: HPAStar.cpp:280
hpaStar::SmoothType
SmoothType
Definition: HPAStar.h:35
hpaStar::maxy
int maxy
Definition: HPAStar.h:85
reservationProvider
Definition: ReservationProvider.h:33
hpaStar::SW
@ SW
Definition: HPAStar.h:32
SearchAlgorithm
A generic algorithm which can be used for pathfinding.
Definition: SearchAlgorithm.h:25
hpaStar::~hpaStar
virtual ~hpaStar()
Definition: HPAStar.h:41
path
A linked list of nodes which form a continuous path.
Definition: Path.h:20
hpaStar::lookup
std::vector< node * > lookup
Definition: HPAStar.h:74
hpaStar::miny
int miny
Definition: HPAStar.h:84
hpaStar::END
@ END
Definition: HPAStar.h:37
hpaStar::getPartialPathLimit
int getPartialPathLimit()
Definition: HPAStar.h:54
hpaStar::NW
@ NW
Definition: HPAStar.h:33
hpaStar::tonum
node * tonum
Definition: HPAStar.h:73
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
hpaStar::EAST
@ EAST
Definition: HPAStar.h:27