Skip to main content

Module waypoint_router

Module waypoint_router 

Source

Structs§

FixedLegs
The fixed portion of an in-progress route — start → each waypoint → the last waypoint — computed once and reused while only the cursor (head) moves. Split out of RouteRequest::route so the live RouteTool preview recomputes only the trailing head leg per frame. Read-only (no occupancy applied).
Laid
A route laid out leg by leg, and whether every leg found a path.
RouteRequest
A route to lay out: its two endpoints and the waypoints in between (ids in order, positions by id), plus whether each routed leg adds its own occupancy.
TaggedPoint

Enums§

SelfCost
Route start → each waypoint (by id) → end on a ClosedRouter, resolving waypoint positions through wp_positions. Adds NO geometry (channels were seeded at build): each leg is routed with ClosedRouter::route_leg.

Functions§

add_route_cost
Occupy a completed route on a ClosedRouter by adding cost to the graph edges each wire covers (the in-place analogue of the old segment-based occupancy).
route_edges_blocked
Whether any of a route’s edges crosses a blocked rectangle on a ClosedRouter (read-only; no rebuild).
route_fixed_legs
Route the fixed start → … → last waypoint portion of an in-progress route. Identical to the corresponding legs of RouteRequest::route with SelfCost::Skip. wp_positions must contain every id in wp_ids.
route_leg_preferring_straight 🔒
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.
route_to_head
Append the trailing head leg (fixed.tail → head) to the fixed legs — the only part that changes as the cursor moves. head is typically not a graph node, so this leg is the L-path fallback. Together with route_fixed_legs this equals RouteRequest::route with SelfCost::Skip.