-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathastar.h
46 lines (41 loc) · 1.04 KB
/
astar.h
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
#ifndef ASTAR_H
#define ASTAR_H
#include <QPointF>
#include <unordered_map>
#include "environment.h"
#include <vector>
#include <list>
#include <QList>
#include "dijkstra.h"
class Astar
{
public:
Astar();
Astar(Environment* env, QPointF start, QPointF destination, float radius);
void planning();
int calcKeyFromPoint(const Point &point);
int calcNextKey(const int ¤tKey, int index);
int getMinfromOpen();
bool inClosed(int key);
bool inOpen(int key);
void calcPlanningPath();
void calcVisitedPath();
float calcH(const Point &point);
Point startPoint;
Point destinationPoint;
unordered_map<int, Point> global_map; //全局网格地图
//算法的辅助队列
list<int> open;
list<int> closed;
//存储访问过的节点
vector<int> visitedPoint;
vector<int> path;
QList<QPointF> planningPath;
QList<QPointF> visitedPath;
int width;
int high;
int min_x;
int min_y;
int grideSize;
};
#endif // ASTAR_H