-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlot_Video.jl
142 lines (89 loc) · 3.53 KB
/
Plot_Video.jl
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
function Plot_Boundaries!(x, y, size, color)
GR.setmarkertype(GR.MARKERTYPE_ASTERISK)
GR.setmarkersize(size)
GR.setmarkercolorind(color)
GR.polymarker(x, y)
end
function Boundaries_Rectangle_Positions(system_size)
x = vcat(zeros(length(LinRange(0:0.1:system_size[2]))), LinRange(0:0.1:system_size[1]), fill(system_size[1], length(LinRange(0:0.1:system_size[2]))), LinRange(0:0.1:system_size[1]))
y = vcat(LinRange(0:0.1:system_size[2]) , fill(system_size[2], length(LinRange(0:0.1:system_size[1]))), LinRange(0:0.1:system_size[2]), zeros(length(LinRange(0:0.1:system_size[1]))))
return x, y
end
function Plot_Agents!(df::DataFrame, size, color)
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size)
GR.setmarkercolorind(color)
GR.polymarker(df.x, df.y)
end
function Plot_Agents!(df::SubDataFrame, size, color)
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size)
GR.setmarkercolorind(color)
GR.polymarker(df.x, df.y)
end
function Plot_Agents!(df::DataFrame, IDs, size, color)
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size)
GR.setmarkercolorind(color)
for id in IDs
GR.polymarker(df[df.ID .== id, :].x, df[df.ID .== id, :].y)
end
end
function Plot_Agents!(df, size, color, size_2, color_2, dist)
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size)
GR.setmarkercolorind(color)
GR.polymarker(df.x, df.y)
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size_2)
GR.setmarkercolorind(color_2)
e_x = df.v_x ./ sqrt.(df.v_x .^2 .+ df.v_y .^2)
e_y = df.v_y ./ sqrt.(df.v_x .^2 .+ df.v_y .^2)
GR.polymarker(df.x .+ dist .* e_x, df.y .+ dist .* e_y)
end
function Plot_Agents!(df, IDs, size, color, size_2, color_2, dist)
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size)
GR.setmarkercolorind(color)
for id in IDs
GR.polymarker(df[df.ID .== id, :].x, df[df.ID .== id, :].y)
end
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size_2)
GR.setmarkercolorind(color_2)
e_x = df.v_x ./ sqrt.(df.v_x .^2 .+ df.v_y .^2)
e_y = df.v_y ./ sqrt.(df.v_x .^2 .+ df.v_y .^2)
for id in IDs
e_x = df[df.ID .== id, :].v_x ./ sqrt.(df[df.ID .== id, :].v_x .^2 .+ df[df.ID .== id, :].v_y .^2)
e_y = df[df.ID .== id, :].v_y ./ sqrt.(df[df.ID .== id, :].v_x .^2 .+ df[df.ID .== id, :].v_y .^2)
GR.polymarker(df[df.ID .== id, :].x .+ dist .* e_x, df[df.ID .== id, :].y .+ dist .* e_y)
end
end
function Plot_Agents_TTC!(df::SubDataFrame, size)
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size)
gdf = groupby(df, :ID)
for df_i in gdf
red = max(min(1.0, 1.0 - df_i.TTC[1]/10), 0.0)
GR.setcolorrep(1, red, 0.1, 0.1)
GR.setmarkercolorind(1)
GR.polymarker(df_i.x, df_i.y)
end
end
function Plot_Agents_TTC!(df, size, size_2, color_2, dist)
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size)
gdf = groupby(df, :ID)
for df_i in gdf
red = max(min(1.0, 1.0 - df_i.TTC[1]/10), 0.0)
GR.setcolorrep(1, red, 0.1, 0.1)
GR.setmarkercolorind(1)
GR.polymarker(df_i.x, df_i.y)
end
GR.setmarkertype(GR.MARKERTYPE_SOLID_CIRCLE)
GR.setmarkersize(size_2)
GR.setmarkercolorind(color_2)
e_x = df.v_x ./ sqrt.(df.v_x .^2 .+ df.v_y .^2)
e_y = df.v_y ./ sqrt.(df.v_x .^2 .+ df.v_y .^2)
GR.polymarker(df.x .+ dist .* e_x, df.y .+ dist .* e_y)
end