pub fn desired_force_2d(
x: f64,
y: f64,
vx: f64,
vy: f64,
dest_x: f64,
dest_y: f64,
desired_speed: f64,
tau: f64,
) -> (f64, f64)Expand description
Desired force driving an agent toward its destination in 2D.
f_desired = (v0 * e_hat - v) / tau
where e_hat is the unit vector toward the destination, v0 is the desired
speed, v = (vx, vy) is the current velocity, and tau is the relaxation
time.
Returns (fx, fy). If the agent is already at the destination (within
1e-12), returns (0, 0).