-
Notifications
You must be signed in to change notification settings - Fork 3
/
Map.cpp
executable file
·48 lines (38 loc) · 1.24 KB
/
Map.cpp
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
#include "Map.h"
Line::Line(Point p1, Point p2) {
this->p1 = p1;
this->p2 = p2;
}
Line::Line() {
}
bool Line::collides(double Cx, double Cy,
double Dx, double Dy,
double *X, double *Y) {
return lineSegmentIntersection(p1.x, p1.y, p2.x, p2.y, Cx, Cy, Dx, Dy, X, Y);
}
Point::Point() {
}
Point::Point(double x, double y) {
this->x = x;
this->y = y;
}
Map::Map() {
/*
line1 = Line(Point(0, 0), Point(5, 0));
line2 = Line(Point(5, 0), Point(5, 5));
line3 = Line(Point(5, 5), Point(3, 5));
line4 = Line(Point(3, 5), Point(3, 4));
line5 = Line(Point(3, 4), Point(2, 4));
line6 = Line(Point(2, 4), Point(2, 5));
line7 = Line(Point(2, 5), Point(0, 5));
line8 = Line(Point(0, 5), Point(0, 0));
*/
barriers[0] = Line(Point(0, 0), Point(5, 0));//&line1;
barriers[1] = Line(Point(5, 0), Point(5, 5));//&line2;
barriers[2] = Line(Point(5, 5), Point(3, 5));//&line3;
barriers[3] = Line(Point(3, 5), Point(3, 4));//&line4;
barriers[4] = Line(Point(3, 4), Point(2, 4));//&line5;
barriers[5] = Line(Point(2, 4), Point(2, 5));//&line6;
barriers[6] = Line(Point(2, 5), Point(0, 5));//&line7;
barriers[7] = Line(Point(0, 5), Point(0, 0));//&line8;
}