-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgdastar.h
More file actions
51 lines (36 loc) · 1.01 KB
/
Copy pathgdastar.h
File metadata and controls
51 lines (36 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef __GDASTAR_H__
#define __GDASTAR_H__
#include <vector>
#include <utility>
#include "reference.h"
#include "stlastar.h"
using namespace std;
class MapSearchNode {
public:
std::vector< std::pair<int, int> > *_map;
int x; // the (x,y) positions of the node
int y;
MapSearchNode();
MapSearchNode(int px, int py, std::vector< std::pair<int, int> > *pmap);
int GetMap(int x, int y);
float GoalDistanceEstimate(MapSearchNode &nodeGoal);
bool IsGoal(MapSearchNode &nodeGoal);
bool GetSuccessors(AStarSearch<MapSearchNode> *astarsearch, MapSearchNode *parent_node);
float GetCost(MapSearchNode &successor);
bool IsSameState(MapSearchNode &rhs);
void PrintNodeInfo();
};
class gdAstar : public Reference {
OBJ_TYPE(gdAstar, Reference);
protected:
static void _bind_methods();
AStarSearch<MapSearchNode> astarsearch;
std::vector< std::pair<int, int> > astarMap;
public:
gdAstar();
~gdAstar();
void AddPoint(int x, int y);
void ClearPoints();
Vector2Array FindPath(int x0, int y0, int x1, int y1);
};
#endif