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
//! What a single constraint on the merged vertex's radius looks like, how a set of them folds into
//! a radius, and the three ways a method can end.
//!
//! The methods differ in which constraints their correspondence can find. They do not differ in
//! how a set of constraints becomes a radius, and keeping that difference visible is why this is
//! its own module rather than three private helpers.
/// The three ways any of the error methods can end.
///
/// The distinction between the last two is the whole reason this is an enum rather than an
/// `Option`: one says the collapse is impossible, the other says only that *this method* cannot
/// judge it and something else should.
pub
/// The weight below which a landing is treated as carrying none of the merged vertex.
///
/// A constraint with no weight on the unknown is not a constraint on it, so it is either already
/// satisfied by the fixed radii or satisfiable by nothing.
const MERGED_WEIGHT_EPS: f64 = 1.0e-9;
/// One linear constraint on the radius the merged vertex is about to take.
///
/// Under Objective B every radius in the star except the merged one is already fixed, so every
/// constraint any of the methods can produce reduces to this single shape:
///
/// ```text
/// coeff * e_merged + known >= need
/// ```
///
/// `need` is what the landing has to reach, a distance plus whatever radius is already carried on
/// the other side. `known` is the part of the barycentric blend at the landing which sits on link
/// vertices, whose radii this collapse does not change. `coeff` is the weight that same blend puts
/// on the merged vertex, which is the only thing left to solve for.
///
/// Having one shape for all of them is not tidiness. It is what makes two error methods comparable:
/// they differ in which constraints they can find, and not in how a set of constraints is turned
/// into a radius.
pub
/// Folds constraints into the smallest merged radius that satisfies all of them, which is Objective
/// B's one-dimensional solve.
///
/// Constraints are folded as they are found rather than collected into a list first. The acceptance
/// test runs several times per collapse on the hot path, and an allocation there is not worth the
/// tidier signature.
pub