-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.h
58 lines (43 loc) · 1.27 KB
/
map.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
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef MAP_H
#define MAP_H
#include "parser.h"
#include "clipper/clipper.hpp"
#include "point.h"
using namespace ClipperLib;
struct Edges
{
double left, right, up, down;
Edges(double l, double r, double u, double d) : left(l), right(r), up(u), down(d) {}
};
class Map
{
public:
Map(double sseed = 1, double rad = 0);
Map(const char *filename, double seed, double rad);
~Map();
int * operator [] (int i);
const int * operator [] (int i) const;
std::vector<std::vector<Point<int> > > get_obstacles();
bool in_bounds(Point<int> point);
void get_map(const char *fname);
void create_xml();
void process_map();
int height, width;
private:
int ** grid;
std::vector<std::vector<Point<int> > > obstacles;
Point<int> start, goal;
double seed;
double radius;
std::string logfilename;
bool start_point;
std::vector<Point<int> > offset_polygon(std::vector<Point<int> > polygon, double radius);
const char * title;
std::vector<std::vector<Point<double> > > abs_obstacles;
double abs_height, abs_width;
Point<double> abs_start, abs_goal;
Point<int> convert_abs_point(Point<double> abs_point, Edges new_edge);
void discrete();
Point<int> nearest_int(Point<int> point);
};
#endif // MAP_H