c29c3c3156
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>
25 lines
816 B
C++
25 lines
816 B
C++
#pragma once
|
|
#include "random"
|
|
#include "vector2d.hpp"
|
|
|
|
// For visual simulation
|
|
enum Color { BLACK, WHITE };
|
|
|
|
struct Pedestrian {
|
|
Color color;
|
|
Vector2d curr_vel; // v_alpha (actual, ≤ v_max)
|
|
Vector2d w; // w_alpha (preferred, integrates force)
|
|
Vector2d curr_pos;
|
|
Vector2d e;
|
|
double v_max;
|
|
double desired_v0;
|
|
Vector2d destination;
|
|
Vector2d f_i;
|
|
|
|
Pedestrian() : color(WHITE), curr_vel(0.0, 0.0), curr_pos(0.0, 0.0), e(0.0, 0.0), v_max(0.0), desired_v0(0.0), destination(0.0, 0.0), f_i(0.0, 0.0) {}
|
|
|
|
Pedestrian(Color clr, Vector2d c_v, Vector2d c_p, Vector2d e, double v_max, double desired_v0, Vector2d d, Vector2d f)
|
|
: color(clr), curr_vel(c_v), w(c_v), // initialize w = v at t=0
|
|
curr_pos(c_p), e(e), v_max(v_max), desired_v0(desired_v0), destination(d), f_i(f) {}
|
|
};
|