1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//! # Connector routing
//!
//! Global connector routing: route many connectors at once around rectangular obstacles
//! (diagram nodes, schematic parts, cabinets in a cable plan), minimising length, bends,
//! crossings and overlaps, and place the final segments apart from each other.
//!
//! All geometry is exact integer arithmetic ([`Point`] coordinates within
//! [`MAX_COORD`]); there are no floating-point robustness issues and results are
//! reproducible. The crate is `no_std` and needs only `alloc`.
//!
//! ## Orthogonal routing
//!
//! ```mermaid
//! flowchart LR
//! S[Scene: obstacles, ports, OVG] --> A[route: one connector]
//! S --> G[global::route_all: PathFinder]
//! G --> C[crossing::reduce_crossings]
//! C --> N[nudge::nudge]
//! P[pipeline::draw] --> S
//! ```
//!
//! - [`Scene`]: obstacles and [`Port`]s with their orthogonal visibility graph
//! (Wybrow, Marriott and Stuckey 2009), updated incrementally as obstacles and ports
//! change. [`incremental`] reports which committed routes a change affects.
//! - [`route`](fn@route): the optimal route of one connector under an [`Objective`] (length and
//! bends, exact lexicographic orders available), by A* over `(vertex, heading)`; the
//! 1-bend visibility graph of Marriott et al. (2014) is available as [`Search::OneBend`].
//! - [`global::route_all`]: many connectors with `PathFinder` negotiated congestion over
//! channel capacities, rip-up and reroute, and crossing penalties.
//! - [`crossing`]: required crossings between routes, crossing reduction, and the
//! crossing points of finished routes for drawing hops.
//! - [`nudge`]: ordering of shared segments and exact separation by difference
//! constraints (no LP); the constraints are exported for layout engines.
//! - [`pipeline::draw`]: the pipeline of arXiv 2309.01671 from boxes and edges to a
//! drawing, port assignment included.
//! - [`hyperedge`]: nets with more than two ports as rectilinear Steiner trees
//! (Wybrow et al. 2012).
//! - [`check`]: independent validation of routes.
//!
//! ## Any-angle routing
//!
//! - [`sleeve`]: sleeve routing through an exact constrained Delaunay triangulation
//! with the funnel algorithm (arXiv 2605.17498).
//! - [`polyline`]: incremental shortest poly-line routing over the visibility graph
//! (Wybrow et al. 2005).
//!
//! ## Features
//!
//! - `multi-objective`: `pareto::front`, the Pareto front of one connector over
//! length, bends and crossings (NAMOA*dr from `multiobjective-search`).
//!
//! ## Example
//!
//! ```
//! use connector_routing::{Connector, DirSet, Point, Port, Rect, Scene, check, global, nudge};
//!
//! let mut scene = Scene::new();
//! let boxes = [Rect::new(0, 0, 20, 10), Rect::new(60, 0, 80, 10), Rect::new(30, -30, 50, 40)];
//! for b in boxes {
//! scene.add_obstacle(b)?;
//! }
//!
//! // Two connectors from the left box to the right box, around the box in between.
//! let a = scene.add_port(Port::new(Point::new(20, 3), DirSet::RIGHT))?;
//! let b = scene.add_port(Port::new(Point::new(60, 3), DirSet::LEFT))?;
//! let c = scene.add_port(Port::new(Point::new(20, 7), DirSet::RIGHT))?;
//! let d = scene.add_port(Port::new(Point::new(60, 7), DirSet::LEFT))?;
//! let connectors = [Connector { source: a, target: b }, Connector { source: c, target: d }];
//!
//! let routing = global::route_all(&scene, &connectors, &global::Config::default())?;
//! let nudged = nudge::nudge(scene.graph(), &boxes, &routing.routes, &nudge::Config::default());
//! for route in &nudged.routes {
//! assert!(check::orthogonal(route, &boxes).is_ok());
//! }
//!
//! assert_eq!(nudged.overlaps, 0);
//! # Ok::<(), connector_routing::Error>(())
//! ```
//!
//! See `docs/design.md` for the models, the deviations from the papers found by
//! testing, and the paper table.
//!
//! Repository: <https://github.com/sunsided/connector-routing>
extern crate alloc;
/// Doctests for the code examples in README.md (not part of the API).
pub use Error;
pub use ;
pub use ;
pub use Net;
pub use ;
pub use ;
pub use ;
/// A connector to route between two ports.