Skip to main content

integrate_euler_2d

Function integrate_euler_2d 

Source
pub fn integrate_euler_2d(
    x: f64,
    y: f64,
    vx: f64,
    vy: f64,
    fx: f64,
    fy: f64,
    dt: f64,
    params: &SocialForceParams,
) -> (f64, f64, f64, f64)
Expand description

Euler integration with speed clamping in 2D.

Updates velocity with the given acceleration (m/s²), clamps the speed to params.max_speed, then advances position. All force primitives in this module already return accelerations (they divide Newton-scale coefficients by params.mass internally), so the sum of their outputs can be passed directly as (fx, fy) here.

Returns (new_x, new_y, new_vx, new_vy).