-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathenvironment.h
90 lines (76 loc) · 2.21 KB
/
environment.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
Assume a rectangular region 500m x 15m in dimensions. A road of width 10m runs at the
centre. Surrounding the road are two pavements of width 2m each. Outside the pavements, there
are grassy regions of width 0.5m on each side. There are two zebra crossings on the road,
one at 1/4th the length of the road and the other at 3/4th the length. Let us call the first
crossing A and the second one B.
The origin lies at the bottom left corner of the rectangle. The x co-ordinate increases
from left to right while the y co-ordinate increases from the bottom to top.
*/
#ifndef ENVIRONMENT
#define ENVIRONMENT
//#define WINDOW_X_SIZE 2000
//#define WINDOW_Y_SIZE 1000
#define WINDOW_X_SIZE 1200
#define WINDOW_Y_SIZE 700
#define X_MIN 0
#define X_MAX 15
#define Y_MIN 0
#define Y_MAX 500
#define PAVEMENT_LEFT_X_MIN 0.5
#define PAVEMENT_LEFT_X_MAX 2.5
#define PAVEMENT_RIGHT_X_MIN 12.5
#define PAVEMENT_RIGHT_X_MAX 14.5
#define PAVEMENT_LEFT_Y_MIN 0
#define PAVEMENT_LEFT_Y_MAX 500
#define PAVEMENT_RIGHT_Y_MIN 0
#define PAVEMENT_RIGHT_Y_MAX 500
#define ZEBRA1_Y_MIN 124
#define ZEBRA1_Y_MAX 126
#define ZEBRA2_Y_MIN 374
#define ZEBRA2_Y_MAX 376
#define USE_ZEBRA_CROSS 1
#define NUM_ZEBRA_CROSSING 2
struct zebra_crossing {
double y_min;
double y_max;
double x_min;
double x_max;
double width;
};
#define NUMBER_OF_PEDESTRIANS 3000
#define NUMBER_OF_TIMESTEPS 10000
#define TIME_STEP_DURATION 5e-3
/* NORMAL CHANCE THAT IS USED:
#define CHANCE_EXIT 0
#define CHANCE_SAME_PAVEMENT 35
#define CHANCE_CROSS 50
#define CHANCE_STOP 15
/**/
#define CHANCE_EXIT 0
#define CHANCE_SAME_PAVEMENT 0
#define CHANCE_CROSS 100
#define CHANCE_STOP 0
class Environment
{
public:
Environment()
{
set_zebra_cross(zebra_crossings[0],124,126,2.5,12.5,2);
set_zebra_cross(zebra_crossings[1],374,376,2.5,12.5,2);
};
//zebra_crossing zebra_1 = {124, 126, 2.5, 12.5, 2};
//zebra_crossing zebra_2 = {374, 376, 2.5, 12.5, 2};
//zebra_crossing zebra_crossings [2]= {zebra_1, zebra_2};
zebra_crossing zebra_crossings[2];
protected:
void set_zebra_cross(zebra_crossing &z, double y_min, double y_max, double x_min, double x_max, double width)
{
z.y_min = y_min;
z.y_max = y_max;
z.x_min = x_min;
z.x_max = x_max;
z.width = width;
}
};
#endif