This commit is contained in:
Nguyen Quy Anh
2026-03-27 17:20:55 +01:00
parent 980bb5635e
commit d347534ff2
9 changed files with 450 additions and 79 deletions
+85
View File
@@ -0,0 +1,85 @@
#pragma once
#include "vector2d.hpp"
#include "random"
struct Pedestrian {
// TODO: Update initial values
Pedestrian() :
curr_vel(),
curr_pos(),
e(),
v_max(1.34 * 1.3),
desired_v0(1.34),
destination(),
F_i(),
next_pos(),
next_vel(),
w_alpha()
{}
Pedestrian(
Vector2d c_v,
Vector2d c_p,
Vector2d e,
Vector2d d,
Vector2d f,
Vector2d n_p,
Vector2d n_v,
Vector2d w_alpha
) :
curr_vel(c_v),
curr_pos(c_p),
e(e),
v_max(),
desired_v0(),
destination(d),
F_i(f),
next_pos(n_p),
next_vel(n_v),
w_alpha(w_alpha)
{}
// $\vec{v}_{\alpha}(t)$
Vector2d curr_vel;
// $\vec{r}_\alpha(t)$
Vector2d curr_pos;
// $\vec{e}_{\alpha}(t)$
Vector2d e;
// $v_{\alpha}^{max} = 1.3 v^{0}_{\alpha}$
double v_max;
// $v_\alpha^0$
double desired_v0;
// # =============================================================
// $\vec{r}^0_\alpha$
Vector2d destination;
// social force
Vector2d F_i;
// # =============================================================
// $\vec{r}_\alpha(t+1)$
Vector2d next_pos;
// $\vec{v}_{\alpha}(t + 1)$
Vector2d next_vel;
// $\vec{w}_{\alpha}$
Vector2d w_alpha;
// # =============================================================
void update() {
curr_pos = next_pos;
curr_vel = next_vel;
e = (destination - curr_pos) / (destination - curr_pos).norm();
}
};