fn reconstruct_legs(
stored: &[Waypoint],
geometry: &mut RouteGeometry,
ends: Endpoints,
rules: LegRules<'_>,
router: Option<&mut ClosedRouter>,
) -> ReconstructionExpand description
Rebuild the edge geometry of a wire whose authored corners are stored,
keeping every straight (axis-aligned, unblocked) leg as a single edge and
routing ONLY the legs that are non-colinear or blocked. start/end are the
resolved grid endpoints. Straight legs never touch the router, so an
unaffected route (all legs straight) is reconstructed byte-identically with
zero pathfinding.
When a leg needs routing, router must be Some (already built and occupied
by the other routes); the leg’s new bends are spliced into the corner list so
the “every corner is a waypoint” invariant is restored. Interior waypoints
that fall inside an obstacle are dropped (only on the routing path, where
router is Some). Nothing here writes the document.