Repository navigation
solidcore: a body whose trim ends in a span shorter than the knot zero saves to a record again (tangency-labs/solidcore#3387) - #23969
Conversation
…zero going round (solidcore#3387) A record pcurve whose last span is shorter than the scaled zero of its end knots (the span a STEP import cut at 2 + 1.2785e-12 on the knot 2 of a circle's form, NIST nist_ftc_09_asme1_rd.stp tangency-labs#5384) reads into the kernel, but its record fails with "knot multiplicity": the kernel makes the close knots one and keeps the control point of the empty span. The test fails until the fix. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…t empties (solidcore#3387) fixup_knot_vector (sm_FixupKnotVector) makes knots closer than the scaled zero of the end knots one knot. Where that empties a span (a trim cut 1.28e-12 past a knot of a circle's form, NIST nist_ftc_09_asme1_rd.stp tangency-labs#5384), the control points that bore only on it stayed, and the knot repeated more than degree + 1 times: the body's record was refused with "knot multiplicity". Every fix-up of a B-spline curve's knots now goes through fixup_curve_knots, which drops each control point P_j with u_j = u_(j+p+1) together with u_j. N_(j,p) is zero there (local support, The NURBS Book P2.1), and the other basis functions keep their windows of p + 2 knots, so the curve is the same on its domain. Co-Authored-By: Claude Code <noreply@anthropic.com>
crv_eval fails at the domain's ends (sm_BasisEval's flag), so the comparison runs on interior parameters; rustfmt. Co-Authored-By: Claude Code <noreply@anthropic.com>
… a span it empties Co-Authored-By: Claude Code <noreply@anthropic.com>
A degree near usize::MAX (piecewise_c0_rejects_unrepresentable_endpoint_ multiplicity) overflowed j + p + 1; the size check now comes first and is checked. The test's weight 1/sqrt(2) is the constant. Co-Authored-By: Claude Code <noreply@anthropic.com>
…rops a point drop_empty_basis compares the whole window u_j..u_(j+p+1). New tests: runs longer than degree + 1 at the start and inside (the curve is the same on both sides of each run's knot), and a copy that drops a point reports Uncertified, not Preserved. The constructors' docs say n can shrink. Co-Authored-By: Claude Code <noreply@anthropic.com>
…emptied span; the kernel's fix-up stays as ported (solidcore#3387) Dropping the points inside the kernel's knot fix-up moved the goldens of nurbs.b_spline_curve_p3 (58 cases), intersect.surface_drop_lib_p2 (23), intersect.surface_tracer (4) and blend.fillet_geom_p1 (2 cases no longer built their face). The kernel's curves keep upstream's knots and points again (b_spline_curve/p1.rs as on main). The record needs a valid B-spline, so the export does it instead: spline_record (an edge's spline) and record_trim (a use's pcurve) write the kernel's curve without each control point P_j with u_j = ... = u_(j+p+1), together with u_j (drop_empty_basis). The record's curve is the kernel's on its domain. WR-23969 says so. Co-Authored-By: Claude Code <noreply@anthropic.com>
…rational trim The test moves to the end of the file, apart from the record_of tests other open PRs extend, and checks a rational trim mapped onto an interval twice as long and scaled as a plane's. record_of's doc says a NURBS is written without the points of an empty support. Co-Authored-By: Claude Code <noreply@anthropic.com>
73d881c
into
tangency-labs:main
Change
Fixes tangency-labs/solidcore#3387.
A solid of the NIST PMI file
nist_ftc_09_asme1_rd.stp(#5384) builds, but saving it as a B-rep record failed withknot multiplicity. Now it saves and reads back.Cause: a hole's trim on a plane face has knots
[e, e, e, 1, 1, 2, 2, d, d, d], d = 2 + 1.28e-12, which is valid. The kernel's knot fix-up (fixup_knot_vector, port ofsm_FixupKnotVector) makes knots closer than the scaled zero of the end knots (3e-12) one knot, so its copy has knot 2 five times at degree 2, and keeps the two control points of the emptied span. The record refuses that.Change: the record of a kernel curve (
spline_recordfor an edge,record_trimfor a pcurve) leaves out each control pointP_jwhose windowu_j..u_(j+p+1)is one knot, withu_j(drop_empty_basis).N_(j,p)is zero there (The NURBS Book P2.1) and the other basis functions keep their knots, so the record's curve is the kernel's on its domain. The kernel's curves stay as ported: its evaluation already skips empty spans. Dropping the points in the fix-up itself moved the goldens of four units, and twoblend.fillet_geom_p1cases no longer built their face. Upstream defect:plan/upstream-issues/WR-23969--….Changes a default: no
Validation
a_pcurve_span_shorter_than_the_kernels_knot_zero_goes_round(solidcore-convert/tests/brep.rs): a square sheet whose pcurve ends in a 1.2785e-12 span goes round twice; saved pcurve[0, 0, 1, 1], (0, 0) to (1, 0); 1 face, 4 edges, 4 vertices. Red at 5f924d2 (Invalid("knot multiplicity")), green at the head.a_record_leaves_out_a_control_point_of_an_emptied_span,a_span_the_fixup_empties_loses_its_control_points,runs_at_the_start_and_inside_lose_their_dead_points: knots and points by hand.trustedtrue and false: 158 faces and 454 edges, as read; the record reads back. At main 3f0e582 all four failed.cargo test -p solidcore -p solidcore-convert9854 passed, 0 failed;goldens: 283 unit(s), 283 passed, 0 failed.Not run: the test suites of crates this change does not touch, doctests, publish dry run and the kernel rig, left to CI.
Units: nurbs.nurbs_crv
In scope: a kernel curve's record keeps every knot at most degree + 1 times.
Expected edits:
curve/from_parameters.rsand its tests,nurbs/nurbs_crv.rs,solidcore-convert/tests/brep.rs,plan/upstream-issues/Evidence: under Validation.
Related PRs / dependencies: #23227, #22637, #14683, #11776 touch the same test files.
Available follow-ups: the fix-up in the kernel's own curves, surfaces and volumes. ftc_06, ftc_08 and ctc_04 fail earlier, at import.
Status / blockers / next step: ready for review.
Screenshots of the behavior (when observable)
Nothing in the body changes on screen. The sketch shows the mechanism: the knot vectors of the trim as imported (valid), after the kernel's fix-up (knot 2 five times), and in the record (knot 2 three times).
Integration status
Branched from main c94db18; merges into main 4ab8112 without conflicts.
Co-written and tested with Claude Code (AI).
Summary by CodeRabbit