Function shortest_path

Source
pub fn shortest_path(
    region: &[Polygon],
    barriers: &[Vec<DVec2>],
    start: DVec2,
    goal: DVec2,
) -> Result<Result<Route, Unreachable>, RouteError>
Expand description

Shortest path from start to goal inside region, avoiding barriers.

barriers are zero-width: they block visibility without bounding area, so a wall that is a line rather than a thin polygon still stops a route. A barrier is a polyline, not a ring, and is not closed implicitly.

Ok(Ok(route)) is a path; Ok(Err(reason)) is a geometric fact that no path exists; Err is a malformed query.