added back formula
This commit is contained in:
@@ -67,7 +67,7 @@ int main(int argc, const char *argv[]) {
|
||||
int n_iter = atoi(argv[2]);
|
||||
|
||||
// Logic to get/dump the simulation data
|
||||
const int dump_interval = 5; // dump every 5 iterations -> 20 fps (since dt = 0.01)
|
||||
const int dump_interval = 50; // dump every 5 iterations -> 20 fps (since dt = 0.01)
|
||||
const char *dump_path = (argc >= 4) ? argv[3] : nullptr;
|
||||
|
||||
std::vector<std::tuple<int, int, double, double, int>> samples; // t, id, x, y, color
|
||||
@@ -89,12 +89,21 @@ int main(int argc, const char *argv[]) {
|
||||
p.f_i.reset();
|
||||
|
||||
// # 8 flops
|
||||
//
|
||||
// $\vec{F}_\alpha(\vec{v}_\alpha, v^0_\alpha \vec{e}_\alpha) \vec{e}_\alpha(t) = \frac{1}{\tau_\alpha}(v^0_\alpha \vec{e}_\alpha - \vec{v}_\alpha)$
|
||||
//
|
||||
compute_acceleration_term(&p);
|
||||
|
||||
// # 55N - 55 flops
|
||||
//
|
||||
// $\sum_{\beta} \vec{F}_{\alpha\beta}(\vec{e}_{\alpha}, \vec{r}_{\alpha} - \vec{r}_{\beta})$
|
||||
//
|
||||
compute_repulsive_effects_from_pedestrians(pedestrians, &p, n_p);
|
||||
|
||||
// # 192 flops
|
||||
//
|
||||
// $\sum_{B} \vec{F}_{\alpha B}(\vec{e}_{\alpha}, \vec{r}_{\alpha} - \vec{r}_{B})$
|
||||
//
|
||||
compute_repulsive_effects_from_borders(board, &p);
|
||||
}
|
||||
// Pass2: integrate the forces and update the current state
|
||||
@@ -109,6 +118,9 @@ int main(int argc, const char *argv[]) {
|
||||
p.curr_vel = p.w * g(p.v_max, p.w.norm());
|
||||
|
||||
// # 4 flops = 2 ADDs, 2 MULTs
|
||||
//
|
||||
// $\vec{r}_i^{t+1} += \vec{r}^t_i + v^t_idt$
|
||||
//
|
||||
p.curr_pos = p.curr_pos + p.curr_vel * dt;
|
||||
|
||||
// how to handle if a pedestrian reached the end of our simulation/end of the hallway
|
||||
|
||||
Reference in New Issue
Block a user