Skip to main content

compute_crossings

Function compute_crossings 

Source
pub fn compute_crossings(
    h_edges: &[HEdge],
    v_edges: &[VEdge],
    num_routes: usize,
) -> Vec<Vec<Crossing>>
Expand description

Pure geometry core of crossing detection (no Block/Store dependency so it can be unit-tested directly). Returns, per route store-order index, the hops that route should draw. A hop is recorded only for a strict interior crossing of a horizontal and a vertical segment (so shared endpoints, corners and T-junctions never hop).

A crossing point is resolved to a single orientation so the wires there jump consistently, then every route crossing in that orientation draws the same hop (all the verticals bump identically over the horizontals, say): a lone H×V pair hops the later route (render order — the one drawn on top), and any busier point always hops vertically.