Skip to main content

wall_repulsion_2d

Function wall_repulsion_2d 

Source
pub fn wall_repulsion_2d(
    x: f64,
    y: f64,
    vx: f64,
    vy: f64,
    radius: f64,
    wall: &WallSegment,
    params: &SocialForceParams,
) -> (f64, f64)
Expand description

Wall repulsion + physical contact acceleration from a single wall segment in 2D.

Same structure as agent-agent repulsion but uses the closest point on the wall segment instead of a neighbor center. Coefficients are divided by params.mass before returning, so the result is in m/s².

§Arguments

  • (x, y) - agent position
  • (vx, vy) - agent velocity
  • radius - agent body radius
  • wall - wall segment
  • params - SocialForceParams (uses mass for normalization)

Returns (ax, ay) - acceleration (m/s²) on the agent.