Skip to main content

Module schematic

Module schematic 

Source
Expand description

The grid’s automatic layout as a schematic: lines only horizontal, vertical or at 45°, as transmission overview diagrams draw them.

The positions crate::layout::force finds are snapped to a lattice, the busiest node first, one that would land on another taking the nearest free point. Each line then runs from lattice point to lattice point in at most three straight pieces, each along an axis or a diagonal: of the shapes it can take (straight; a diagonal and a straight piece, either way round; a straight piece, a diagonal and another), the one that passes through no other node, shares no piece with a line already drawn, crosses the fewest, and bends least. The shorter lines go first, so that local connections keep the plainest shapes. Lines joining the same two nodes (double circuits) run side by side, stepped aside where they leave a node.

Linear in the lines times their lengths on the lattice, and deterministic.

Structs§

Schematic
A schematic: each node’s position and each edge’s route, from its source to its target (in crate::layout::force’s units; a loop has none), and the track each edge runs on.

Functions§

extend
A schematic carried over an edit of what it draws: node i where kept[i] has it, edge k along the route and on the track routes[k] has for it, both in crate::layout::force’s units as octilinear gives them. Nothing kept moves. Each other node goes to the free lattice point nearest the middle of its placed neighbours, off the routes kept; one joined to nothing placed, in a row below the rest. Each other edge is routed as octilinear routes it, around what is drawn, beside an edge kept between the same nodes, and given the nearest free track.
octilinear
Nodes at pos (in crate::layout::force’s units) and their edges, as a schematic.

Type Aliases§

Route
An edge’s route and the track it runs on, as a Schematic has them.