-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpaint.m
92 lines (76 loc) · 4.54 KB
/
paint.m
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
91
92
% plot current situation
if plotting_mode == plotDEFAULT
if(mod(t,10) == 0)
t
end
else
figure(my_figure);
if plotting_mode == plotMAPview
clf
img_scale_factor = 10;
axis(img_scale_factor*[border(1), border(1)+border(3), border(2), border(2)+border(4)]);
axis equal;
hold on;
rgb = imread('Train_EC.jpg');
%image(150,300,rgb);
for itrain = 1:traincount
xtrain = obstacle(itrain, obstacleXCENTER) - obstacle(itrain, obstacleWIDTH)/2;
ytrain = obstacle(itrain, obstacleYCENTER) - obstacle(itrain, obstacleHEIGHT)/2;
% shift dots outside of the train image
if traincount == 2
if itrain == 1
y_offshift = 5;
else
y_offshift = -5;
end
else
y_offshift = 5;
end
image(img_scale_factor*(xtrain), img_scale_factor*(ytrain),rgb);
for a = 1:60
for b = 1:2
if(trainseats(itrain,a,b) >= 4)
plot(img_scale_factor*( xtrain + 150/60 * (a-0.5)), img_scale_factor*( y_offshift + ytrain - 2 + 3*b), 'sr');
elseif(trainseats(itrain,a,b) == 3)
plot(img_scale_factor*( xtrain + 150/60 * (a-0.5)), img_scale_factor*( y_offshift + ytrain - 2 + 3*b), 'sm');
elseif(trainseats(itrain,a,b) == 2)
plot(img_scale_factor*( xtrain + 150/60 * (a-0.5)), img_scale_factor*( y_offshift + ytrain - 2 + 3*b), 'sy');
elseif(trainseats(itrain,a,b) == 1)
plot(img_scale_factor*( xtrain + 150/60 * (a-0.5)), img_scale_factor*( y_offshift + ytrain - 2 + 3*b), 'sc');
else
plot(img_scale_factor*( xtrain + 150/60 * (a-0.5)), img_scale_factor*( y_offshift + ytrain - 2 + 3*b), 'sg');
end
end
end
end
% plot the moving agents (red color = no group, blue color = some
% group)
plot(img_scale_factor*agent(((agent(:,agentSTATE)==agentSTATEmoving) & (agent(:,agentGROUP)==agentGROUPnone)),agentXPOS), ...
img_scale_factor*agent(((agent(:,agentSTATE)==agentSTATEmoving) & (agent(:,agentGROUP)==agentGROUPnone)),agentYPOS), ...
'r.')
plot(img_scale_factor*agent(((agent(:,agentSTATE)==agentSTATEmoving) & (agent(:,agentGROUP)~=agentGROUPnone)),agentXPOS), ...
img_scale_factor*agent(((agent(:,agentSTATE)==agentSTATEmoving) & (agent(:,agentGROUP)~=agentGROUPnone)),agentYPOS), ...
'm.')
plot(img_scale_factor*door(door(:,doorSTATE)>10*dt,doorXPOS), 10*door(door(:,doorSTATE)>10*dt,doorYPOS), 'xr')
plot(img_scale_factor*door(door(:,doorSTATE)<10*dt,doorXPOS), 10*door(door(:,doorSTATE)<10*dt,doorYPOS), 'og')
for iobstacle = (traincount+1):obstaclecount
rect(1,:) = [obstacle(iobstacle,obstacleXCENTER) - obstacle(iobstacle,obstacleWIDTH)/2 , obstacle(iobstacle,obstacleYCENTER) - obstacle(iobstacle,obstacleHEIGHT)/2];
rect(2,:) = [obstacle(iobstacle,obstacleXCENTER) - obstacle(iobstacle,obstacleWIDTH)/2 , obstacle(iobstacle,obstacleYCENTER) + obstacle(iobstacle,obstacleHEIGHT)/2];
rect(3,:) = [obstacle(iobstacle,obstacleXCENTER) + obstacle(iobstacle,obstacleWIDTH)/2 , obstacle(iobstacle,obstacleYCENTER) + obstacle(iobstacle,obstacleHEIGHT)/2];
rect(4,:) = [obstacle(iobstacle,obstacleXCENTER) + obstacle(iobstacle,obstacleWIDTH)/2 , obstacle(iobstacle,obstacleYCENTER) - obstacle(iobstacle,obstacleHEIGHT)/2];
rect(5,:) = [obstacle(iobstacle,obstacleXCENTER) - obstacle(iobstacle,obstacleWIDTH)/2 , obstacle(iobstacle,obstacleYCENTER) - obstacle(iobstacle,obstacleHEIGHT)/2];
if (obstacle(iobstacle,obstacleSTART) <= t) && (obstacle(iobstacle,obstacleEND) >= t)
plot(img_scale_factor*rect(:,1),img_scale_factor*rect(:,2), 'k-');
else
plot(img_scale_factor*rect(:,1),img_scale_factor*rect(:,2), 'k.:');
end
end
%plot(obstacle(obstacle(:,obstacleACTIVE)==1,obstacleXCENTER), ...
% obstacle(obstacle(:,obstacleACTIVE)==1,obstacleYCENTER), 'bs')
text(img_scale_factor*(border(1)+1),img_scale_factor*(border(2)+1),num2str(t));
end
if plotting_mode == plotGRAPHview
clf
plot_saved_data
end
end