Skip to content

Commit 720f76b

Browse files
jyvikoclaude
andcommitted
fix: a round on a round by its definition is the default; its flag is retired (tangency-labs#2647)
`UpstreamFixes::fillet_round_on_round_as_definition` is gone and its path is the only one: a round of one radius on a face that is a round of one radius by its definition is built as its definition and certified on it, and a definition evaluated at one of its stations takes the side it is asked for. It still needs `fillet_round_as_definition` and `fillet_gn_section_generator`, which build the inner round as its definition. The test of the old path (`without_wr714_the_round_on_the_round_is_built_as_before`) is deleted with it; the SmoothInteriorPlan opt-in test now turns off `fillet_round_as_definition`, the one opt-in left; tangency-labs#2364's rig kernels and the corpus's fixes.json drop the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
1 parent 3ef19b2 commit 720f76b

12 files changed

Lines changed: 73 additions & 135 deletions

File tree

‎crates/solidcore/src/blend/fillet_section/definition.rs‎

Lines changed: 53 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ pub struct StationMemo {
402402
/// the side after s, or with `before` on the side before it (c5b6bb7). A foot on a knot
403403
/// line takes its support's partials on the piece it moves into along s (comes from, with
404404
/// `before`), the way the seed moves; the station is solved again with those sides where
405-
/// that is not the piece a solve without sides takes. With
406-
/// [`crate::kernel::UpstreamFixes::fillet_round_on_round_as_definition`] off, `before` is
407-
/// not taken and no station is solved again (fork 5e8c9c1, before c5b6bb7).
405+
/// that is not the piece a solve without sides takes.
408406
///
409407
/// One station solve: the feet by Newton from the seeds, then their series in s (and in
410408
/// tau for the G^n jets) order by order, as the G^n section's stations are built. The
@@ -433,9 +431,6 @@ pub fn evaluate_definition(
433431
) -> Result<Vec<Vec<Vec3>>> {
434432
let def = pb.definition();
435433
count_evaluation(k);
436-
// the side of s (c5b6bb7): only with WR-714's flag; before it the side after s
437-
let sides_taken = k.fixes.fillet_round_on_round_as_definition;
438-
let before = before && sides_taken;
439434
let n = def.order as usize;
440435
// the station: the jets to order n in tau (G^n), or the rails and the centre one
441436
// order more in s (the circle's m')
@@ -529,76 +524,63 @@ pub fn evaluate_definition(
529524
gn_solve_station_with(k, faces, &def.leader, s, seed, r, def.sides, tr, tol, opts);
530525
count_solve(k, steps);
531526
let mut st = solved?.0;
532-
let mut sided = false;
533-
if sides_taken {
534-
// a foot on a knot line of its support: the support's partials there on the
535-
// piece the foot moves into along s (comes from, `before`), as the stations'
536-
// series were taken; the way it moves is the seed's (the stations' feet and
537-
// their s-derivatives, interpolated)
538-
let mut dir = [0.0_f64; 4];
539-
for (f, sd) in def.seeds.iter().enumerate() {
540-
let w = sd.evaluate(s, 1, !before, false)?;
541-
let w1 = w.get(1).copied().ok_or_else(|| SolidError::sm_err(OP))?;
542-
if let Some(x) = dir.get_mut(2 * f) {
543-
*x = w1.x;
544-
}
545-
if let Some(x) = dir.get_mut(2 * f + 1) {
546-
*x = w1.y;
547-
}
527+
// a foot on a knot line of its support: the support's partials there on the
528+
// piece the foot moves into along s (comes from, `before`), as the stations'
529+
// series were taken; the way it moves is the seed's (the stations' feet and
530+
// their s-derivatives, interpolated)
531+
let mut dir = [0.0_f64; 4];
532+
for (f, sd) in def.seeds.iter().enumerate() {
533+
let w = sd.evaluate(s, 1, !before, false)?;
534+
let w1 = w.get(1).copied().ok_or_else(|| SolidError::sm_err(OP))?;
535+
if let Some(x) = dir.get_mut(2 * f) {
536+
*x = w1.x;
548537
}
549-
let on = st.x.map(|x| x.at(0, 0));
550-
let (sides, other) = feet_on_knots(k, faces, on, dir, before, tr.s() + tr.e() + 1)?;
551-
if other {
552-
let opts = StationOptions {
553-
law,
554-
top,
555-
sides: Some(sides),
556-
before,
557-
};
558-
let (solved, steps) = gn_solve_station_with(
559-
k,
560-
faces,
561-
&def.leader,
562-
s,
563-
on,
564-
r,
565-
def.sides,
566-
tr,
567-
tol,
568-
opts,
569-
);
570-
count_solve(k, steps);
571-
st = solved?.0;
538+
if let Some(x) = dir.get_mut(2 * f + 1) {
539+
*x = w1.y;
572540
}
573-
// the side matters only at one of the definition's stations: a foot on a knot
574-
// line, or s a knot of the leader or the law; elsewhere the station is the same
575-
// from either side
576-
sided = sides.iter().any(|&q| q != 0);
577-
// (the leader's derivatives to order s + 1 enter, its unit tangent's; the law's
578-
// to order s; a curve is C^(p - multiplicity) at a knot, its derivatives to
579-
// that order the same either side)
580-
let along = [(Some(&def.leader), ts + 1), (def.law.as_ref(), ts)];
581-
for (curve, used) in along {
582-
if sided {
541+
}
542+
let on = st.x.map(|x| x.at(0, 0));
543+
let (sides, other) = feet_on_knots(k, faces, on, dir, before, tr.s() + tr.e() + 1)?;
544+
if other {
545+
let opts = StationOptions {
546+
law,
547+
top,
548+
sides: Some(sides),
549+
before,
550+
};
551+
let (solved, steps) =
552+
gn_solve_station_with(k, faces, &def.leader, s, on, r, def.sides, tr, tol, opts);
553+
count_solve(k, steps);
554+
st = solved?.0;
555+
}
556+
// the side matters only at one of the definition's stations: a foot on a knot
557+
// line, or s a knot of the leader or the law; elsewhere the station is the same
558+
// from either side
559+
let mut sided = sides.iter().any(|&q| q != 0);
560+
// (the leader's derivatives to order s + 1 enter, its unit tangent's; the law's
561+
// to order s; a curve is C^(p - multiplicity) at a knot, its derivatives to
562+
// that order the same either side)
563+
let along = [(Some(&def.leader), ts + 1), (def.law.as_ref(), ts)];
564+
for (curve, used) in along {
565+
if sided {
566+
break;
567+
}
568+
let Some(curve) = curve else {
569+
continue;
570+
};
571+
let (knots, mult) = curve.knots(None)?;
572+
let deg = curve.degree()?;
573+
let mut m = 1;
574+
while m + 1 < knots.len() && m < mult.len() {
575+
let (Some(&km), Some(&mm)) = (knots.get(m), mult.get(m)) else {
583576
break;
584-
}
585-
let Some(curve) = curve else {
586-
continue;
587577
};
588-
let (knots, mult) = curve.knots(None)?;
589-
let deg = curve.degree()?;
590-
let mut m = 1;
591-
while m + 1 < knots.len() && m < mult.len() {
592-
let (Some(&km), Some(&mm)) = (knots.get(m), mult.get(m)) else {
593-
break;
594-
};
595-
let on_knot = (s - km).abs() <= 1.0e-9 * (1.0 + km.abs());
596-
// used > p - multiplicity, in signed arithmetic
597-
if on_knot && used + mm > deg {
598-
sided = true;
599-
}
600-
m += 1;
578+
let on_knot = (s - km).abs() <= 1.0e-9 * (1.0 + km.abs());
579+
// used > p - multiplicity, in signed arithmetic
580+
if on_knot && used + mm > deg {
581+
sided = true;
601582
}
583+
m += 1;
602584
}
603585
}
604586
let mut memo = k.blend_station_memo.borrow_mut();

‎crates/solidcore/src/blend/fillet_section/definition_box.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//! A face that is a blend by its definition, enclosed over a box of its `(u, v)` for the
2-
//! certificate of a blend on it (opt-in, not upstream): its feet over the box's s by
2+
//! certificate of a blend on it (not upstream): its feet over the box's s by
33
//! Krawczyk's operator on the faces under them (every polynomial piece the feet's box
44
//! covers, hulled), then its arc in rounded interval arithmetic, in the centred form where
55
//! one order more is held. Only a round of the ball's circle (a constant radius) between
66
//! NURBS faces is enclosed.
77
//!
88
//! Not in the pinned upstream: the SolidCraft fork's `source/SMLib/src/SmFilletSection.cpp`
9-
//! (tangency-labs/smlib@c5b6bb7, smlib#101, merged at 852dd8c). Only
10-
//! [`crate::kernel::UpstreamFixes::fillet_round_on_round_as_definition`] builds a blend
11-
//! on such a face.
9+
//! (tangency-labs/smlib@c5b6bb7, smlib#101, merged at 852dd8c). A round of one radius
10+
//! is built on such a face as its definition (WR-714) where
11+
//! [`crate::kernel::UpstreamFixes::fillet_round_as_definition`] builds the inner one.
1212
//!
1313
//! | Rust | Fork (`SmFilletSection.cpp`) |
1414
//! |---------------------------------------|--------------------------------------------------|

‎crates/solidcore/src/blend/fillet_section/section.rs‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,8 @@ pub(crate) fn certificate_faces<'a>(
406406
// the definition's feet's series hold (SM_GN_MAXS); a law's touch circle,
407407
// or a G^n section, takes more: "a face that is a blend by its definition:
408408
// only a round of one radius is certified on it, and only on a round of one
409-
// radius between NURBS faces". Without WR-714 a blend by its definition is
410-
// enclosed only on its net, which is not the surface the feet are solved on
411-
// (4a10ed8)
412-
let enclosed = k.fixes.fillet_round_on_round_as_definition
413-
&& order == 1
414-
&& !has_law
415-
&& definition_enclosable(face);
409+
// radius between NURBS faces" (WR-714)
410+
let enclosed = order == 1 && !has_law && definition_enclosable(face);
416411
if !enclosed {
417412
return Err(SolidError::sm_err(OP));
418413
}

‎crates/solidcore/src/blend/fillet_section/smooth_interior_plan.rs‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ pub struct SmoothInteriorPlan<'a> {
7373
impl<'a> SmoothInteriorPlan<'a> {
7474
/// Freezes widths and checks numerical G2 rail compatibility at each station.
7575
///
76-
/// Requires the existing procedural and sided-evaluation opt-ins. This is an
76+
/// Requires the procedural definition opt-in (`fillet_round_as_definition`). This is an
7777
/// explicit preparation request, not a flag enabling corrected evaluation.
7878
/// No threshold is supplied by the caller: checks use 512 machine epsilons
7979
/// times the measured jet scale. Passing them does not prove exact vanishing
8080
/// of rational coefficients, or the absence of an interior singularity.
8181
///
8282
/// # Errors
83-
/// Refuses non-G2 definitions, missing opt-ins, invalid partitions,
83+
/// Refuses non-G2 definitions, the missing opt-in, invalid partitions,
8484
/// unrepresentable widths, nonfinite/singular rail jets, or rail jumps that
8585
/// violate the required vanishing orders. Propagates station solve errors.
8686
pub fn prepare(k: &Kernel, definition: &'a ProceduralBlend, initial: &[f64]) -> Result<Self> {
87-
if !k.fixes.fillet_round_as_definition || !k.fixes.fillet_round_on_round_as_definition {
87+
if !k.fixes.fillet_round_as_definition {
8888
return Err(SolidError::invalid_input(
8989
OP,
90-
"correction preparation requires procedural and sided definition opt-ins",
90+
"correction preparation requires the procedural definition opt-in",
9191
));
9292
}
9393
if definition.order() != 2 {
@@ -151,16 +151,12 @@ impl<'a> SmoothInteriorPlan<'a> {
151151
/// Takes the full sided section jumps at an interior station and section height.
152152
///
153153
/// # Errors
154-
/// Invalid station index/height, missing definition opt-ins, or a solve error.
154+
/// Invalid station index/height, the missing definition opt-in, or a solve error.
155155
pub fn jump_at(&self, k: &Kernel, station: usize, t: f64) -> Result<JumpJet> {
156-
if !k.fixes.fillet_round_as_definition
157-
|| !k.fixes.fillet_round_on_round_as_definition
158-
|| !t.is_finite()
159-
|| !(0.0..=1.0).contains(&t)
160-
{
156+
if !k.fixes.fillet_round_as_definition || !t.is_finite() || !(0.0..=1.0).contains(&t) {
161157
return Err(SolidError::invalid_input(
162158
OP,
163-
"procedural/sided definition opt-ins and a height in [0,1] required",
159+
"the procedural definition opt-in and a height in [0,1] required",
164160
));
165161
}
166162
let station = self

‎crates/solidcore/src/blend/fillet_standard_solver/p2.rs‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2952,8 +2952,8 @@ impl CircularCrossSectionFsg {
29522952
/// replaced ([`GnSectionFsg::build_given_ball`]), unless the rails or the centre line
29532953
/// turn at a knot (`sm_FilletCurveCorners`: the pieces are built as before), a face is
29542954
/// not an offset of a NURBS surface (or is a blend by its definition, unless the ball is
2955-
/// of one radius, the face a round of one radius between NURBS faces and
2956-
/// `fixes.fillet_round_on_round_as_definition` on: c5b6bb7, WR-714), the circle is
2955+
/// of one radius and the face a round of one radius between NURBS faces: c5b6bb7,
2956+
/// WR-714), the circle is
29572957
/// not exact (approximated, mirrored or the larger arc), the solver is neither a
29582958
/// constant-radius one with one radius above the tolerance nor (0d43b4c, b8e3594) an
29592959
/// edge's variable-radius one whose law is a B-spline or linear one, its base curve a
@@ -3029,11 +3029,7 @@ impl CircularCrossSectionFsg {
30293029
| SurfaceKind::Cone(_)
30303030
| SurfaceKind::Sphere(_)
30313031
| SurfaceKind::Torus(_) => true,
3032-
SurfaceKind::ProceduralBlend(_) => {
3033-
k.fixes.fillet_round_on_round_as_definition
3034-
&& constant_ball
3035-
&& definition_enclosable(b)
3036-
}
3032+
SurfaceKind::ProceduralBlend(_) => constant_ball && definition_enclosable(b),
30373033
_ => false,
30383034
};
30393035
if !nurbs {

‎crates/solidcore/src/kernel.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,6 @@ pub struct UpstreamFixes {
15411541
/// those of the circles beside it: that round is then 8.1e-5 off. Off: the fork's
15421542
/// 523bc25 and 5e8c9c1 (WR-711, a fix of WR-708).
15431543
pub fillet_exact_arc_spans: bool,
1544-
/// With [`Self::fillet_round_as_definition`] (and [`Self::fillet_gn_section_generator`]) also on (a no-op otherwise): a round of one radius on a face that is itself a round of one radius between NURBS faces by its definition is built as its definition, two deep. Its certificate encloses the inner definition's partials over each of its boxes: each box cut at the inner round's leader knots it crosses, the inner round's feet by Krawczyk's operator on the faces under them (their box cut at the knot lines it crosses, each part on its own polynomial piece, hulled), then its arc in interval arithmetic, in the centred form where one order more is held and the feet cross no knot line ([`crate::blend::fillet_section::definition_box`]): the inner definition piecewise, each piece exact, whatever its net's stations (#2570). The outer round has a station wherever its rail crosses one of the inner round's stations (its net's knots), where the inner round is only C1, and takes one-sided series there: a definition evaluated at one of its stations takes its partials on the side it is asked for (`EvaluateDefinition`'s `bBefore`, from the evaluators' `FromLeft` flags), a foot on a knot line of its face on the piece it moves into. A law or G^n inner round, and a G^n or variable outer round, are refused or built as before. Off: a round on a definition is built as before, and a definition's partials at a station are the side after it (WR-714, #2298; the fork's tangency-labs/smlib@c5b6bb7, smlib#101, merged at 852dd8c).
1545-
pub fillet_round_on_round_as_definition: bool,
15461544
/// With `fillet_cliff_overflow` (and its prerequisites), a blend past its faces is trimmed at its creases where it is built instead of being closed into the region it removes and subtracted (the fork's `SmFilletExecutive::TrimAtCreases`, `SmFilletOverflow.cpp`, tangency-labs/smlib#79 step 6 at 5e8c9c1, which deletes `SubtractRemovalRegion`): the open ends are cut by their end faces' planes as before; each sheet face is sectioned by every body face near it that holds none of its boundary, exactly by a plane, and split along each crease where it lies inside both faces; a piece is kept only when its inner point lies inside the body; a planar support face whose kept rail runs past its boundary into the material is carried on along its plane to the rail; the kept sheet's boundary is imprinted on the body's faces, the faces it encloses round the blended edges are deleted, the sheet is merged in and stitched, the body oriented, and the edges between faces sewn in on one surface removed. The blend keeps its radius and the sharp edge moves. Refused with `FilletErrorType::NoRoom`: a crease on a face that runs on tangentially from a face the blend rolls on (`NoRoomReason::CreaseAcrossTangentEdge`), a blend whose corners take its whole edge (`CornersTakeWholeEdge`), and a rail into the material that the support face cannot be carried on to (`RailRunsPastFaceIntoMaterial`); `BadMerge` for a sheet that does not sew into a manifold solid. Off: the subtraction, as before (WR-695, #2273).
15471545
pub fillet_overflow_trim_at_creases: bool,
15481546
/// With both `fillet_overflow_trim_at_creases` and `fillet_round_ends_at_tangent_continuation`, a round with a section end (WR-674: its filleted edge runs on tangentially at the vertex) is trimmed at its creases and sewn into the body as a cliff overflow is, instead of being closed into the region it removes and subtracted: each section end is cut by its plane through the vertex normal to the filleted edge and given its flat end face (the section's corner, from the section's ends to the vertex), and the sheet is trimmed and sewn in as `fillet_overflow_trim_at_creases` does it; a side of an end face that lies along an edge of the body (the seam where a corner's cylinder runs on tangentially into a flat side) is sewn to that edge's piece instead of being imprinted. So a round with a section end is built together with other rounds (an R25 rim and an R2 corner arc of a tabbed plate rounded together, which the subtraction refuses with `FilletErrorType::NoRoom`: it builds only a lone round both of whose ends are section ends). Off: the subtraction, as before (WR-706, #2223; own design, not in the fork, which at 5e8c9c1 leaves such a corner arc unrounded).

‎crates/solidcore/tests/fork_7959c0e_round_on_a_round.rs‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -408,30 +408,6 @@ fn round_on_a_definition_is_its_definition() {
408408
assert!(o.crossings >= 4 && o.missed == 0, "{o:?}");
409409
}
410410

411-
/// Without WR-714 the round on the round is built as before: not a definition (the
412-
/// fork's known-failing mark at 7959c0e, "a round on a face that is a blend by its
413-
/// definition is not built as its definition: the certificate does not enclose the inner
414-
/// definition yet"), and the body still checks clean.
415-
#[test]
416-
fn without_wr714_the_round_on_the_round_is_built_as_before() {
417-
let mut k = solidcraft_kernel();
418-
k.fixes.fillet_round_on_round_as_definition = false;
419-
let o = round_on_a_round(&mut k);
420-
println!(
421-
"{} round(s) on a round by definition, {} spans: sections off the ball's circle by {:.3e}, the net at {:.3} of its bound; {} definition evaluations, {} station solves; the rail crosses the inner round's stations {} times, {} without a station of its own",
422-
o.graded,
423-
o.spans,
424-
o.circle,
425-
o.net,
426-
o.counts.evaluations,
427-
o.counts.solves,
428-
o.crossings,
429-
o.missed
430-
);
431-
assert!(o.sound, "{o:?}");
432-
assert_eq!(o.graded, 0, "{o:?}");
433-
}
434-
435411
/// The net `net` with its distinct inner knot `kv` along s taken out (every copy of it),
436412
/// one control row fewer per copy: the net a knot removal leaves. Only its knots along s
437413
/// are read by the enclosure of its definition (they name the piece whose station seeds

‎crates/solidcore/tests/issue_2356_smooth_interior.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ fn fixture_order(curved: bool, order: u32) -> (Kernel, ProceduralBlend) {
5555
let mut k = Kernel::default();
5656
k.fixes.fillet_gn_section_generator = true;
5757
k.fixes.fillet_round_as_definition = true;
58-
// Sided definition evaluation is provided by #2322, not #2274 alone.
59-
k.fixes.fillet_round_on_round_as_definition = true;
6058
let wall = Surface::from(
6159
BSplineSurface::create_bilinear_surface(
6260
Point3::ZERO,
@@ -195,7 +193,7 @@ fn preparation_refuses_invalid_partitions_and_missing_opt_ins() {
195193
stations[0].parameter() + stations[0].lambda()
196194
< stations[1].parameter() - stations[1].lambda()
197195
);
198-
k.fixes.fillet_round_on_round_as_definition = false;
196+
k.fixes.fillet_round_as_definition = false;
199197
assert!(plan.jump_at(&k, 0, 0.5).is_err());
200198
assert!(SmoothInteriorPlan::prepare(&k, &pb, &[0.0, 0.5, 1.0]).is_err());
201199
}

0 commit comments

Comments
 (0)