Files
Brett Lawson 79ad8f039a Sketch profiles keep a spline's exact curve to a crossing; short swept arcs make exact cylinders (#17462) (#18415)
* Claim #17462: fillet of r=0.25 on a spline tangent chain fails (status 1001)

Empty claim commit; the fix follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNXLXh7c1S97vY2G8GgerR

* Profiles keep a spline's exact curve up to a crossing; short swept arcs make exact cylinders (#17462)

A 0.25 fillet along the spline chain of the reporter's design failed with status 1001.
Sketch profile detection dropped the free-form tag of every polyline piece another curve
splits, so a loop that turns where a spline crosses a circle bridged from the spline's last
whole piece to the crossing with a straight chord. The 0.12 mm chord became a sliver face on
the extruded slot wall, its edge part of the fillet chain, and the blend's pcurves met in a
cusp at its end. Split pieces now keep their tag, so restore_exact gives the loop the exact
sub-segment up to the Newton-refined crossing. Coverage stays off for split pieces.

With the exact curve, a 0.008 mm sub-cubic became a profile curve. The linear sweep took it
for a 0.005 degree arc and built its cylinder on the arc fit's normal, 5e-8 rad off the sweep
(accepted, as 53 mm times that is under the B-rep tolerance), so the wall leaned across the
sweep and SolidCraft's flat-array round trip could not re-recognise its NURBS form:
- create_linear_sweep: a cylinder made from an arc within tolerance of square to the sweep
  now has the sweep direction as its axis, its origin in the profile plane (square_to_sweep).
- Cone::is_nurb_surface_cylinder (iso_arc_from_chord): with the ruling as the axis, the arc
  is held to the ruling's plane by its control points' distance (the distance zero) instead
  of the legs' normal angle, which on so short an arc carries 2e-8 rad of rounding.

Tests: profiles a_spline_crossing_a_circle_keeps_its_exact_curve_to_the_crossings; cone p2
a_very_short_extruded_arc_is_a_cylinder_whatever_its_legs_normal; solidcore
tests/issue_17462_short_arc_sweep_axis.rs. Each fails without its fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNXLXh7c1S97vY2G8GgerR

* Profiles: a run over every piece of a segment is whole only from its start to its end (#17462)

Split pieces now keep their free-form tag, so a loop that enters a segment at a crossing inside
its first piece (or leaves at one inside its last) has as many pieces, in order, as the whole
segment. restore_exact took such a run for the whole segment and put back the part before the
crossing too: a text crossed by a rectangle lost 0.46% of its picked area
(ui-egui sketch_text::tests::a_text_crossed_by_an_edge_is_picked_whole). The whole segment now
also needs the run's ends on the segment's ends; otherwise the run is a cut sub-segment, refined
at its crossings as before. The #17462 sketch test also checks that the two regions' areas add
up to the disc's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNXLXh7c1S97vY2G8GgerR

* Linear sweep squares an arc's frame only for a profile certified flat across the sweep (#17462 review)

square_to_sweep turned any arc frame within distance*tilt <= tol of square to the sweep
exactly square, and moved its origin into the plane through the curve's start. That check does
not bound the profile's own offset from that plane, up to 2r*tilt. A whole circle of radius 50
swept 0.01 at a tilt of 1e-4 (the default whole-circle path) ended 1e-2 off its cylinder's base
edge and the body was not manifold. The frame is now squared only when the convex hull of the
curve's control points (piece_hull_points, each widened by its coordinate error bound) lies
within the arc zero of the plane square to the sweep through the curve's start. Otherwise the
fit's frame stays, as upstream. The 0.005 degree arc of #17462 (control points an ulp off their
plane) is still squared.

Tests:
- The short-arc sweep test moves to tests/issue_1477_arc_sweep_cylinder.rs, the WR-565 area
  file. It now sweeps a closed profile with caps and asserts a manifold solid with the profile
  on the cylinder's base edge (axially, not only radially).
- New: four tilted profiles (whole circle and half disc; r 50, tilt 1e-4, distance 0.01; r 100,
  tilt 1e-7, distance 5) keep a manifold solid with the profile on the base edge.
- New sketch test: a loop between crossings inside a spline's first and last polyline pieces
  takes only the part between them (fails without the run-ends check).
- The run-ends check uses MERGE_TOL; p2.rs's comment names the plane's point correctly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNXLXh7c1S97vY2G8GgerR

* Sweep test helper: dereference the Copy cylinder placement (clippy clone_on_copy)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNXLXh7c1S97vY2G8GgerR

* Linear sweep squares an arc's frame only when the squared circle stays on the profile (#17462 review r2)

The flatness test bounded only the profile's offset along the sweep. The squared circle keeps
the fit's radius and angles about the projected centre, so a short arc that really lies in a
plane tilted about its chord stayed within the arc zero of the square plane yet missed the
squared circle by about r t^2 / 2 across: 4.4e-5 for r 88 at a tilt of 1e-3, 4.4e-3 and no
manifold solid at 1e-2 (a short distance lets distance * tilt pass).

square_to_sweep now also bounds the in-plane change: with xa = X.a, ya = Y.a,
t^2 = xa^2 + ya^2, cx = sqrt(1 - xa^2) and m = xa ya / cx, |C'(u) - proj C(u)| <=
r (t^2 + |m| + m^2), derived in the doc comment. The axial bound plus that must be within the
arc zero. The axial certificate now counts the reference point's own error bound and the
rounding of the subtraction and dot product (gamma_4 (|p| + |q|) s).

New test: issue_17462_a_short_arc_tilted_about_its_chord_stays_on_its_cylinder (the review's
three rows plus a 10 degree control), asserting a manifold solid with the profile on the base
edge axially and radially. Removing the in-plane bound fails it (4.4e-5 off); removing the
axial bound fails it and the tilted-profile test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNXLXh7c1S97vY2G8GgerR

* Linear sweep: count the in-plane bound's absolute rounding; NaN-refusing acceptances (#17462 review r3)

The in-plane bound r (t² + |m| + m²) was widened only by a relative (1 + 16 ε). That does not
cover the error of xa = X·a and ya = Y·a: dot products of unit vectors that cancel when the
tilt is small, so their error (γ₃) is absolute and unbounded relative to them; nor the axes'
own orthonormality and the rounding of the squared frame's X', Y'. square_to_sweep now
considers only t² <= 1/4 (a 30° tilt is never a fit's rounding), where |∂B/∂xa| + |∂B/∂ya| < 5,
and adds 64 ε r for those absolute errors; the derivation is in the doc comment. This only
narrows when squaring happens, by about r·1e-14.

The acceptances are written so that a NaN in either side keeps the fit's frame
(`let within = x <= zero; if !within`), and the module doc says the squared circle is
certified against the circle the arc test accepted, not against the profile itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNXLXh7c1S97vY2G8GgerR

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 01:37:31 +00:00
..
2026-11-04 11:39:05 -05:00