Skip to main content

Crate blockworx_router

Crate blockworx_router 

Source
Expand description

The wire router: an orthogonal, channel-based path finder over the same integer lattice the document stores geometry on.

Blocked rectangles and routing channels are declared into a RouterNGBuilder, which builds the channel graph once and freezes it into a ClosedRouter. Routing a leg then only reweights existing edges, so a whole frame’s routes share one graph.

The lattice is blockworx_geom::grid’s: a point::Point converts to and from blockworx_geom::Pos2 through the same rounding the document’s grid↔world bridge uses, and directly to and from blockworx_doc::geometry::GridPoint, which is already lattice-aligned.

Modules§

block
channel
coord
The routing lattice’s per-axis coordinates. The grid is double-ended, so a coordinate is signed; the two axes are separate types so a CoordX cannot be handed to something expecting a row.
cost
event
point
segment
turtle

Structs§

BlockAxisIndex 🔒
A per-axis index of the (immutable) block set, so channel seeding iterates only the blocks that intersect a query coordinate instead of scanning them all. Built once when the closed geometry is assembled. by_y[y] lists the blocks whose vertical extent (expanded by one, matching RouterNG::seed_horiz_channel) contains y; by_x[x] the blocks whose horizontal extent (expanded by one) contains x. Same coordinate-keyed BTreeMap<Coord, Vec<_>> shape as the segment maps.
Bounds
The rectangle a lattice covers.
ClosedRouter
A RouterNG whose geometry has been built and frozen: it exposes routing and in-place edge-weight mutation, but no method to add segments/channels or rebuild the graph. Occupancy of a completed route is applied by adding WIRE_COST to the existing graph edges the wire covers, so no rebuild is needed (see Finding 1 in TUNING.md).
Fingerprint
A lattice in a form two routers can be compared by. See ClosedRouter::fingerprint.
Leg
One leg as routed: its points, the direction it arrives in, and whether the lattice held a path for it.
Opening
A closed lattice being added to. Mirrors RouterNGBuilder’s vocabulary, because what it records are the same requests.
Requests 🔒
What a lattice was asked for, as asked rather than as resolved.
RouterNG
RouterNGBuilder
SearchState 🔒

Enums§

Direction
Resolution
Whether a leg found a path through the lattice, or fell back to an L that ignores it — which may run straight through a block.

Constants§

MOVE_COST 🔒
TURN_COST 🔒
WIRE_COST

Functions§

collect_intersections 🔒
Every crossing of a horizontal segment by a vertical one, by a line sweep in x: each horizontal segment contributes an Enter and an Exit event at its ends, each vertical segment a Scan event at its x, and a Scan reports the horizontal segments active at that moment whose y falls inside its span.
cross_cost 🔒
direction_between
The cardinal direction of travel from from to to, or None if the points coincide. Greater y is South, matching the successor walk the search itself uses.
interval_overlap 🔒
normalize_collinear_segments 🔒
scan_disjoint_segments 🔒
turn_cost 🔒