Skip to main content

brep_blend/blending/blend/
mod.rs

1//! General rolling-ball blends (Golovanov §4.9 + §6.9 surgery).
2//!
3//! The blend surface is the rational surface (4.9.1) built from three
4//! curves: the two support curves cr(t) ⊂ F1 and cs(t) ⊂ F2 where a
5//! sphere of radius ρ touches both faces, and the middle curve at the
6//! intersection of the two tangent planes, weighted w(t) = cos(α/2)
7//! (4.9.3).  The tangency system (4.9.2) + the section-plane constraint
8//! (4.9.5) — the sphere center pinned to the normal plane of the edge —
9//! is solved per station by Newton with a finite-difference Jacobian.
10//!
11//! Topology is rebuilt the §6.9 way, with NO tool solid and NO boolean:
12//! each mating face's loop swaps the blended edge's coedge for a coedge
13//! on its support curve (trimming the adjacent seam edge when the face
14//! is a closed carrier with seam-in-one-loop topology), and the blend
15//! face is inserted with its own seam.  Open edges take the same route
16//! (`edge/open.rs`), and a whole SELECTION goes through `network.rs`, which
17//! marches every stripe against the original solid and solves each shared
18//! corner from its ball before anything is cut.
19
20pub mod carve;
21pub mod chain;
22pub mod collapse;
23pub mod convex_parallel;
24pub mod corner;
25pub mod creased_rim;
26pub mod edge;
27pub mod fold;
28pub mod miter;
29pub mod network;
30pub use network::STRIPE_PINCH_TAPER_WHAT;
31pub mod planar_chart;
32pub mod same_parameter;
33pub use same_parameter::same_parameter_trims;
34mod restrict;
35pub mod rollover;
36pub mod rollover_surgery;
37pub mod setback;
38pub mod setback_corner;
39pub mod runout;
40pub mod split_rim;
41pub mod turned_rim;
42pub mod sheet_ends;
43pub mod stations;
44pub mod rows;
45pub mod track_fit;
46
47/// A transverse end with parallel normals needs a tapered runout, not cutter
48/// composition. The network tries that runout before propagating this refusal.
49pub const TANGENTIAL_TRANSVERSE_END: &str = "tangential_transverse_end";
50
51pub fn is_tangential_transverse_end(refusal: &crate::KernelRefusal) -> bool {
52    matches!(&refusal.class, crate::RefusalClass::UnsupportedGeometry { what }
53        if what == TANGENTIAL_TRANSVERSE_END)
54}
55
56/// Whether the open march's local station refinement runs. Escape hatch
57/// `BREP_BLEND_REFINE=0` restores the uniform ladder exactly; a test turns it
58/// off for its own thread with `set_refinement_off_for_test`.
59pub fn station_refinement_on() -> bool {
60    switch!(live "BREP_BLEND_REFINE", true)
61}
62
63thread_local! {
64    static BLEND_NOTES: std::cell::RefCell<Vec<String>> = const { std::cell::RefCell::new(Vec::new()) };
65}
66
67thread_local! {
68    /// Set only while the open-pad composition (`fillet/edges.rs`, the
69    /// 2026-10-17 face-ring report) builds its two stages on this thread.
70    static OPEN_PAD_NETWORK: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
71}
72
73/// Runs `build` as the open-pad composition's network: the open march takes
74/// a station where a contact crosses its carrier's domain boundary and the
75/// row fit breaks there (`march_open_stations_core`), and the march extends
76/// past a section end that lies outside the overshoot
77/// (`open_station_parameters`). Both are what the composition's walls need
78/// (the F6 blend rail of the reported ring stood 7.1e-5 off its carrier at
79/// the boundary; the pads' stripes start before their trims) and both move
80/// a body the plain network already built (2026-10-18: the reported model's
81/// F6 moved by a refinement rung and a broken row), so outside the
82/// composition every network is built exactly as before. Restores the flag
83/// after.
84pub fn with_open_pad_network<T>(build: impl FnOnce() -> T) -> T {
85    /// Restores the previous flag on every exit path, an unwinding panic
86    /// included, so a later network on this thread never inherits it.
87    struct Reset(bool);
88    impl Drop for Reset {
89        fn drop(&mut self) {
90            OPEN_PAD_NETWORK.with(|flag| flag.set(self.0));
91        }
92    }
93    let _reset = Reset(OPEN_PAD_NETWORK.with(|flag| flag.replace(true)));
94    build()
95}
96
97/// Whether the march runs as the open-pad composition's network (see
98/// [`with_open_pad_network`]).
99pub(in crate::blend) fn open_pad_network_on() -> bool {
100    OPEN_PAD_NETWORK.with(|flag| flag.get())
101}
102
103/// An equal-radius convex star on four planar faces with no common ball closes
104/// as the rolling ball does: a ridge cylinder between two sphere triangles.
105/// `BREP_BLEND_RIDGE_STAR=0` restores the ribbon fill.
106const RIDGE_STAR_DEFAULT: bool = true;
107
108pub fn ridge_star_on() -> bool {
109    switch!(live "BREP_BLEND_RIDGE_STAR", RIDGE_STAR_DEFAULT)
110}
111
112/// The STOPPED-END rollover of an open stripe (user bug F10, 2026-11-02):
113/// a track that leaves its mate across a tangent edge before the stripe's
114/// own vertex and never comes back — the F10 fillet's rails run 1.1e-2 past
115/// faces 13/23's boundaries onto the F8 blend faces 19/26 — has its tail
116/// re-marched on the neighbour from the crossing station and the cap's
117/// legs drawn on the neighbours. Default OFF: `BREP_BLEND_STOPPED_END_ROLLOVER=1`
118/// turns it on. Promotion owes the blend/fillet filters and both censuses
119/// with the switch on.
120const STOPPED_END_ROLLOVER_DEFAULT: bool = false;
121
122pub fn stopped_end_rollover_on() -> bool {
123    switch!(live "BREP_BLEND_STOPPED_END_ROLLOVER", STOPPED_END_ROLLOVER_DEFAULT)
124}
125
126/// Equal-length chains are unchanged either way; unequal ones move their
127/// stations, so it lands behind this switch until its census:
128/// `BREP_BLEND_CHAIN_ARC_STATIONS=1` turns it on, `=0` off;
129/// `set_chain_arc_stations_for_test` forces it on a test's own thread.
130const CHAIN_ARC_STATIONS_DEFAULT: bool = false;
131
132pub fn chain_arc_stations_on() -> bool {
133    switch!(live "BREP_BLEND_CHAIN_ARC_STATIONS", CHAIN_ARC_STATIONS_DEFAULT)
134}
135
136#[derive(Clone, Debug, PartialEq)]
137pub enum StripeRadius {
138    Constant(f64),
139    /// `(edge fraction, radius)` stops sorted by fraction, interpolated
140    /// linearly between and held flat past the ends: `blend_edge_variable`'s
141    /// convention, which the law entries sample into.
142    Stops(Vec<(f64, f64)>),
143}
144
145impl StripeRadius {
146    /// From a stop list: one constant when every stop carries the same
147    /// radius (to 1e-12 relative, the single-edge lane's own test).
148    pub fn from_stops(stops: &[(f64, f64)]) -> Self {
149        let mut sorted = stops.to_vec();
150        sorted.sort_by(|a, b| a.0.total_cmp(&b.0));
151        match sorted.first() {
152            Some(&(_, first)) if sorted.iter().all(|(_, r)| (r - first).abs() <= 1e-12 * (1.0 + first.abs())) => {
153                StripeRadius::Constant(first)
154            }
155            _ => StripeRadius::Stops(sorted),
156        }
157    }
158
159    /// The radius at an edge fraction in `[0, 1]` (clamped).
160    pub fn at_fraction(&self, fraction: f64) -> f64 {
161        match self {
162            StripeRadius::Constant(radius) => *radius,
163            StripeRadius::Stops(stops) => {
164                let fraction = fraction.clamp(0.0, 1.0);
165                if fraction <= stops[0].0 {
166                    return stops[0].1;
167                }
168                for pair in stops.windows(2) {
169                    if fraction <= pair[1].0 {
170                        let width = (pair[1].0 - pair[0].0).max(1e-12);
171                        return pair[0].1 + (pair[1].1 - pair[0].1) * (fraction - pair[0].0) / width;
172                    }
173                }
174                stops[stops.len() - 1].1
175            }
176        }
177    }
178
179    /// The constant, for a constant law.
180    pub fn constant(&self) -> Option<f64> {
181        match self {
182            StripeRadius::Constant(radius) => Some(*radius),
183            StripeRadius::Stops(_) => None,
184        }
185    }
186
187    /// The largest radius the law takes.
188    pub fn largest(&self) -> f64 {
189        match self {
190            StripeRadius::Constant(radius) => *radius,
191            StripeRadius::Stops(stops) => stops.iter().map(|(_, r)| *r).fold(0.0, f64::max),
192        }
193    }
194
195    /// The law's END value at the edge's start (`at_start`) or finish: what
196    /// the user asked for at that vertex, and the constant every corner solve
197    /// there uses (C2).
198    pub fn end(&self, at_start: bool) -> f64 {
199        self.at_fraction(if at_start { 0.0 } else { 1.0 })
200    }
201
202    /// Whether every radius is positive and finite.
203    pub fn is_positive(&self) -> bool {
204        match self {
205            StripeRadius::Constant(radius) => radius.is_finite() && *radius > 0.0,
206            StripeRadius::Stops(stops) => !stops.is_empty() && stops.iter().all(|(_, r)| r.is_finite() && *r > 0.0),
207        }
208    }
209}
210
211
212/// Record what a blend that SHIPS needs its feature to say about it — today,
213/// a march whose rails still stand off their carriers after its station
214/// ladder and local refinement ran out. Drained per feature by the history
215/// loop ([`take_blend_notes`]), beside the soundness acceptance's repairs.
216pub fn record_blend_note(note: String) {
217    BLEND_NOTES.with(|notes| notes.borrow_mut().push(note));
218}
219
220/// Take every blend note recorded on this thread since the last call.
221/// Blending runs on the feature's own thread (no parallel march), so the
222/// history loop's drain sees every note its feature recorded.
223pub fn take_blend_notes() -> Vec<String> {
224    BLEND_NOTES.with(|notes| std::mem::take(&mut *notes.borrow_mut()))
225}
226
227/// The ledger's length, and a way back to it: a lane that refuses takes back
228/// the notes it recorded, so a note never describes a wall that did not ship.
229pub fn blend_notes_mark() -> usize {
230    BLEND_NOTES.with(|notes| notes.borrow().len())
231}
232
233pub fn blend_notes_truncate(mark: usize) {
234    BLEND_NOTES.with(|notes| notes.borrow_mut().truncate(mark));
235}
236
237/// A fillet chain wall that SHIPPED short of the construction request its
238/// accepted rung made (`KernelTolerances::model` on the wall between its
239/// rails): which wall — the blend face's name and its exact surface — what
240/// was asked, what the wall reads, and the typed budget that ran out.
241#[derive(Clone, Debug)]
242pub struct WallModelReport {
243    pub name: Option<String>,
244    pub surface: crate::NurbsSurface,
245    pub request: f64,
246    pub residual: f64,
247    /// What else the lane measured that the message must say (an unaccepted
248    /// rung's deficit, a ladder rung's local refinement), verbatim.
249    pub detail: Option<String>,
250    pub budget: crate::ApproximationBudget,
251}
252
253thread_local! {
254    static BLEND_APPROXIMATIONS: std::cell::RefCell<Vec<WallModelReport>> = const { std::cell::RefCell::new(Vec::new()) };
255}
256
257thread_local! {
258    static BLEND_OPERATION_DEPTH: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
259}
260
261/// One blend OPERATION's scope on this thread: every public blend entry point
262/// (and the history loop, around each feature) holds one. The OUTERMOST
263/// entry drops whatever an earlier operation recorded and nobody consumed —
264/// a direct API caller consumes ([`take_blend_approximations`]) after the
265/// operation whose reports it wants, before starting the next — while a
266/// nested entry (a fillet's per-edge chain blend) clears nothing, so every
267/// report of the operation in flight is kept, however many there are.
268pub struct BlendOperation;
269
270impl BlendOperation {
271    pub fn enter() -> BlendOperation {
272        BLEND_OPERATION_DEPTH.with(|depth| {
273            if depth.get() == 0 {
274                BLEND_APPROXIMATIONS.with(|reports| reports.borrow_mut().clear());
275                timing::begin_operation();
276            }
277            depth.set(depth.get() + 1);
278        });
279        BlendOperation
280    }
281}
282
283/// Whether the innermost open blend operation is the outermost one (no
284/// nested operation inside another).
285pub fn blend_operation_outermost() -> bool {
286    BLEND_OPERATION_DEPTH.with(|depth| depth.get() <= 1)
287}
288
289impl Drop for BlendOperation {
290    fn drop(&mut self) {
291        BLEND_OPERATION_DEPTH.with(|depth| {
292            depth.set(depth.get().saturating_sub(1));
293            if depth.get() == 0 {
294                timing::end_operation();
295            }
296        });
297    }
298}
299pub use crate::blend_timing as timing;
300pub use timing::{blend_timing_capture, take_blend_timings, BlendTiming};
301pub use timing::{record_count, BlendTimer};
302
303/// Record a wall that ships with its request unmet. Written by the rung that
304/// keeps its body; whether the body reaches a caller is decided at
305/// consumption ([`take_blend_approximations`]), not here. Every report of
306/// the operation in flight is kept (see [`BlendOperation`]).
307pub fn record_wall_model_report(report: WallModelReport) {
308    BLEND_APPROXIMATIONS.with(|reports| reports.borrow_mut().push(report));
309}
310
311
312/// Whether any wall-model report is waiting (the history loop reads the
313/// returned bodies only then).
314pub fn blend_approximations_pending() -> bool {
315    BLEND_APPROXIMATIONS.with(|reports| !reports.borrow().is_empty())
316}
317
318/// Bit-identical surfaces: the same degrees, knots and homogeneous control
319/// points, compared by their bits.
320pub fn same_surface(a: &crate::NurbsSurface, b: &crate::NurbsSurface) -> bool {
321    let bits = |values: &[f64]| values.iter().map(|value| value.to_bits()).collect::<Vec<_>>();
322    a.degree_u == b.degree_u
323        && a.degree_v == b.degree_v
324        && bits(&a.knots_u) == bits(&b.knots_u)
325        && bits(&a.knots_v) == bits(&b.knots_v)
326        && a.control_points.len() == b.control_points.len()
327        && a.control_points.iter().zip(&b.control_points).all(|(row_a, row_b)| {
328            row_a.len() == row_b.len()
329                && row_a.iter().zip(row_b).all(|(p, q)| {
330                    [p.x, p.y, p.z, p.w].map(f64::to_bits) == [q.x, q.y, q.z, q.w].map(f64::to_bits)
331                })
332        })
333}
334
335/// Whether `face_name` names the report's wall: its exact name, or that
336/// name with the `[k]` (decimal) suffix `ensure_unique_face_names` gives a
337/// colliding name at registration. Nothing else: no prefix, no other suffix.
338fn names_the_wall(face_name: &Option<String>, report_name: &Option<String>) -> bool {
339    match (face_name, report_name) {
340        (Some(face), Some(report)) => {
341            face == report
342                || face.strip_prefix(report.as_str()).and_then(|rest| rest.strip_prefix('[')).and_then(|rest| rest.strip_suffix(']')).is_some_and(
343                    |index| !index.is_empty() && index.bytes().all(|byte| byte.is_ascii_digit()),
344                )
345        }
346        (None, None) => true,
347        _ => false,
348    }
349}
350
351/// Consume EVERY wall-model report recorded on this thread since the last
352/// call, in ONE snapshot, against ALL the bodies a call returned
353/// (`(body name, solid)`): a report becomes a typed `blend.wall_model`
354/// [`crate::Approximation`] on each body carrying its wall — a face with a
355/// bit-identical surface AND the report's name, exactly or as registration
356/// renamed it (`NAME[k]`) — and is dropped when no returned body carries it
357/// (a lane that refused, a body a later step discarded). A wall carried by
358/// two returned bodies (one surface, bit for bit, in both) is reported on
359/// both: the reading is a property of that surface. Reports for one wall
360/// collapse to the last. Never a match by name alone.
361/// `take_blend_approximations(&[])` discards everything recorded (the
362/// history loop's stale drain before a feature runs).
363pub fn take_blend_approximations(bodies: &[(&str, &crate::BrepSolid)]) -> Vec<crate::Approximation> {
364    let snapshot = BLEND_APPROXIMATIONS.with(|reports| std::mem::take(&mut *reports.borrow_mut()));
365    let mut unique: Vec<WallModelReport> = Vec::new();
366    for report in snapshot {
367        unique.retain(|kept| !(kept.name == report.name && same_surface(&kept.surface, &report.surface)));
368        unique.push(report);
369    }
370    let mut approximations = Vec::new();
371    for (body, solid) in bodies {
372        for report in &unique {
373            let carried = solid.shells.iter().flat_map(|shell| &shell.faces).any(|face| {
374                names_the_wall(&face.name, &report.name) && same_surface(&face.surface, &report.surface)
375            });
376            if carried {
377                let wall = report.name.as_deref().unwrap_or("(unnamed)");
378                let unaccepted = matches!(report.budget.reason, crate::BudgetReason::Unaccepted | crate::BudgetReason::Unread);
379                let budget = match report.budget.mechanism {
380                    crate::BudgetMechanism::LocalRounds => format!(
381                        "local refinement stopped: {:?} after {} of {} rounds, {} of {} stations per segment",
382                        report.budget.reason, report.budget.rounds_used, report.budget.rounds_limit,
383                        report.budget.stations, report.budget.station_limit,
384                    ),
385                    crate::BudgetMechanism::StationRungs => format!(
386                        "the open march's station ladder stopped: {:?} after {} of {} global station rungs, {} of {} stations",
387                        report.budget.reason, report.budget.rounds_used, report.budget.rounds_limit,
388                        report.budget.stations, report.budget.station_limit,
389                    ),
390                };
391                let unknown = report.budget.unread > 0;
392                let rails = report.budget.measured_component == crate::MeasuredComponent::Rails;
393                let mut message = if !unaccepted && (rails || unknown) {
394                    // A request that covers the rails and the wall says WHICH
395                    // it measured, and never offers a partial reading as the
396                    // worst: with unread intervals the worst is unknown.
397                    let what = if rails {
398                        format!("the fillet wall {wall}'s support rails stand")
399                    } else {
400                        format!("the fillet wall {wall} stands")
401                    };
402                    let against = if rails {
403                        "off their exact construction (their carriers / the exact ball contacts)"
404                    } else {
405                        "from the rolling ball between its rails"
406                    };
407                    let reading = if unknown {
408                        format!(
409                            "an UNKNOWN distance {against}: {} interval(s) could not be read (the largest READABLE reading is {:.3e} mm, not the worst)",
410                            report.budget.unread, report.residual
411                        )
412                    } else {
413                        format!("{:.3e} mm {against}", report.residual)
414                    };
415                    format!(
416                        "{what} {reading}, against a construction request of {:.3e} mm (accepted at the intersection-fit bar); {budget}",
417                        report.request,
418                    )
419                } else if unaccepted {
420                    format!(
421                        "the blend wall {wall} ships from a rung that never met acceptance: its worst reading \
422                         {:.3e} mm against its acceptance bar {:.3e} mm; {budget}",
423                        report.residual, report.request,
424                    )
425                } else {
426                    format!(
427                        "the fillet wall {wall} stands {:.3e} mm from the rolling ball between its rails, against a \
428                         construction request of {:.3e} mm (accepted at the intersection-fit bar); {budget}",
429                        report.residual, report.request,
430                    )
431                };
432                if let Some(detail) = &report.detail {
433                    message = format!("{message} ({detail})");
434                }
435                approximations.push(crate::Approximation {
436                    code: if unaccepted { "blend.wall_acceptance" } else { "blend.wall_model" }.to_string(),
437                    body: body.to_string(),
438                    measured: report.residual,
439                    bar: report.request,
440                    volume_bound: None,
441                    edges: Vec::new(),
442                    budget: Some(report.budget.clone()),
443                    message,
444                });
445            }
446        }
447    }
448    approximations
449}
450
451
452pub use chain::{blend_smooth_chain, blend_smooth_chain_if_closed};
453pub use chain::smooth_chain_members;
454pub use corner::round_concave_chain_corner;
455pub use corner::round_convex_corner;
456pub use corner::{is_n_sided_undercut_refusal, N_SIDED_FOLD_WHAT, N_SIDED_UNDERCUT_WHAT};
457pub use edge::{blend_closed_edge, blend_closed_edge_knot_aware, blend_edge_variable, blend_open_edge, is_pcurve_floor_refusal, with_pcurve_knot_retry};
458pub(crate) use edge::{blend_closed_edge_reusing, remember_closed_refusal, ClosedRefusalScope};
459pub use collapse::is_full_width_collapse;
460pub use planar_chart::{
461    chart_fitted_for_gate, fit_planar_charts_to_trims, is_planar_chart_refusal, planar_chart_overrun,
462};
463pub use track_fit::PCURVE_OFF_FLOOR;
464pub use edge::{consumed_band, is_consumed_snap, is_rail_collapse};
465pub use network::{
466    blend_star_network, blend_star_network_laws, blend_star_network_with_corner_policy, degenerate_corner_setbacks, mixed_convexity_corner, mixed_convexity_corners, selection_convexity, MixedCorner,
467};
468pub use miter::{is_marched_fit_off_carriers, is_miter_support_overrun};
469/// The two faces each selected edge lies on, in the network's mate order
470/// (the open-pad composition reads which is planar and which is the boss).
471pub fn selection_mates<'a>(
472    solid: &'a crate::topology::BrepSolid,
473    edge_ids: &[u64],
474    radius: f64,
475) -> Result<Vec<(&'a crate::topology::EdgeRecord, [&'a crate::topology::FaceRecord; 2])>, crate::KernelRefusal> {
476    Ok(network::stripe_mates(solid, edge_ids, radius)?
477        .into_iter()
478        .map(|(edge, first, second)| (edge, [first.face, second.face]))
479        .collect())
480}
481
482pub use runout::{build_runout_walls, plan_runout, RunoutPlan};
483pub use fold::{is_rail_fold, is_wall_fold, wall_loop_refusal, WALL_FOLDS};
484pub use stations::is_ball_off_carrier;
485pub use network::is_ball_does_not_fit;
486pub use network::{body_carries_wrapped_corner, reject_wrapped_network, with_wrap_sharp_corners, wrap_sharp_corners_on, WrapOutcome};
487
488/// Off the switch every closed rim's two support pcurves are refitted to their
489/// rail's projected track (`edge/closed.rs::refit_closed_support_pcurve`, the
490/// closed chain's support-piece fitter: a dense track of analytic feet, a
491/// verified fit ladder and the shipped read), 96 of the half torus's 98 ms of
492/// rows. On the switch each trim is first READ as shipped at the same floor
493/// (`track_fit::read_shipped_pcurve`, `PCURVE_REFINEMENT_TOLERANCE`): a plane
494/// mate's trim is the rail's own control points through the plane's affine
495/// chart (exact by construction, the exact revolution lane's rule); any other
496/// mate's trim, or an image that misses, takes the refit as before (the
497/// march's own interpolated pcurve was measured as a candidate and dropped:
498/// 8.5e-5 off on the half torus's torus mate). The shipped contract is
499/// unchanged (every trim read within the floor); the bytes are not, so it
500/// landed OFF and was promoted by its census (the kernel battery, the case
501/// manifest and hlr_tests with the switch on). ON by default;
502/// `BREP_BLEND_CLOSED_TRIM_READ_FIRST=0` is the escape hatch back to the refit
503/// road, `=1` forces it on; `set_closed_trim_read_first_for_test` forces
504/// either way on a test's thread.
505const CLOSED_TRIM_READ_FIRST_DEFAULT: bool = true;
506
507pub fn closed_trim_read_first_on() -> bool {
508    switch!(live "BREP_BLEND_CLOSED_TRIM_READ_FIRST", CLOSED_TRIM_READ_FIRST_DEFAULT)
509}
510
511
512/// The check solves 31 centres per interval by continuation from the
513/// neighbour, each a full station Newton with a finite-difference Jacobian
514/// rebuilt at every iteration (eleven evaluations of the tangency system a
515/// centre, 89 of the half torus's 169 ms of march). On the switch each centre
516/// is seeded by a quadratic extrapolation through the last three and solved
517/// by the chord method with the Jacobian carried from centre to centre
518/// (`stations::solve_station_state_chord`), to the plain solver's own stop;
519/// the plain solver from the neighbour is the fall-back for anything the
520/// chord cannot finish. The centres are the same roots to the same tolerance,
521/// not the same bits: the declared wall reading moves in its last digits, its
522/// verdict and the body do not, which is why it landed OFF and was promoted
523/// by its census. ON by default; `BREP_BLEND_CLOSED_WALL_PREDICT=0` is the
524/// escape hatch back to the plain continuation solves, `=1` forces it on;
525/// `set_closed_wall_predict_for_test` forces either way on a test's thread.
526const CLOSED_WALL_PREDICT_DEFAULT: bool = true;
527
528pub fn closed_wall_predict_on() -> bool {
529    switch!(live "BREP_BLEND_CLOSED_WALL_PREDICT", CLOSED_WALL_PREDICT_DEFAULT)
530}
531
532
533// BREP lane L: begin keyway_floor_open_mixed_corner_20261014
534pub use corner::round_mixed_concave_open_corner;
535// BREP lane L: end keyway_floor_open_mixed_corner_20261014
536
537
538
539// Lane R7 (2026-10-19): the tapered cusp runout; `BREP_BLEND_TAPER_RUNOUT`.
540pub mod taper_runout;
541
542// 2026-10-21: the local radius relief of a folding constant fillet;
543// `BREP_BLEND_RADIUS_RELIEF`.
544pub mod relief;