Skip to main content

route_leg_preferring_straight

Function route_leg_preferring_straight 

Source
fn route_leg_preferring_straight(
    router: &mut ClosedRouter,
    a: Point,
    b: Point,
    incoming: Option<Direction>,
) -> Leg
Expand description

Route one leg, but PREFER a straight axis-aligned segment whenever one is legal: if a and b share a row or column and the direct wire neither crosses nor hugs a block, take it — even if the pathfinder could find a lower-cost detour around existing wires. Legs that are non-colinear, cross a block, or would hug one (run alongside an edge within the routing gutter) fall back to ClosedRouter::route_leg, which bows out into the gutter. This keeps a hand-placed waypoint path literal: a straight run between two waypoints stays straight.