store preffered velocity w_alpha separately from the actual v_alpha

now we track w_alpha across steps to preserve speed over time memory (equation 10 and 11)

In the pedestrian 2.pass (integrate) we now integrate dw/dt = F instead of dv/dt = F

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
lbaumberger
2026-04-26 17:25:37 +02:00
parent 36a0c7b8f2
commit c29c3c3156
2 changed files with 9 additions and 4 deletions
+4 -2
View File
@@ -78,10 +78,12 @@ int main(int argc, const char *argv[]) {
for (int i = 0; i < n_p; i++) {
Pedestrian &p = pedestrians[i];
// # 4 flops = 2 ADDs, 2 MULTs
Vector2d w_alpha = p.curr_vel + p.f_i * dt;
// integrate preferred velocity: dw/dt = F (Eq. 10)
p.w = p.w + p.f_i * dt;
// Vector2d w_alpha = p.curr_vel + p.f_i * dt; // commented since this was using p.curr_vel instead of p.w (different from paper)
// # 8 flops = 2 MULTs, 2 DIVs, 1 SQRT, 2 MULTs, 1 ADD
p.curr_vel = w_alpha * g(p.v_max, w_alpha.norm());
p.curr_vel = p.w * g(p.v_max, p.w.norm());
// # 4 flops = 2 ADDs, 2 MULTs
p.curr_pos = p.curr_pos + p.curr_vel * dt;