Skip to main content

detect_collision

Function detect_collision 

Source
pub fn detect_collision(
    a: &[f64; 2],
    b: &[f64; 2],
    obstacle: &CircleObstacle,
) -> bool
Expand description

Determines whether a line segment intersects a circle.

The line segment is defined by endpoints a and b. The circle is defined by center c and radius.

Uses projection of circle center onto line segment to find closest point.