Repository navigation
Conversation
…ngency-labs#3951) A closed B-spline edge was split at its vertex parameter, and a vertex just past the curve's start produced a piece whose parameter range is below what the curve library accepts, so evaluating it panicked and the whole body was lost. A vertex that close to either end now counts as that end, and no piece below that range is produced. Fixes tangency-labs#3951
a8bcaf0 to
d7194de
Compare
|
Checked against the public model in tangency-labs/models#22 (five surface bodies, each bounded by one closed spline edge whose vertex sits 1e-9, 3e-8, 2e-7, 8e-7 or 5e-6 mm past the curve's start):
The file attached to #3951 also gives 1 body, 400 mm², no panic. An open edge that crosses a closed curve's seam (starting 3e-8 … 5e-6 before the curve's end) already reads correctly on 0.18.1, so the problem is limited to closed edges. |
|
Thank you for this work! We're evaluating a new geometry kernel (solidcore), so kernel pull requests are on hold for now and I've set this one to draft: see #3992. Nothing is lost: your branch, commits and review history stay exactly as they are. The case you fixed here goes into the new kernel's regression suite, so it stays fixed whatever kernel we end up on. And if you'd like to keep going on this kind of problem, we'd love your help in solidcore, starting with porting this case over as a test. |
Fixes #3951
A closed B-spline edge is split at its vertex parameter. The reader treated a vertex within
span * 1e-7of the curve's start as "at the start", but truck's knot-range check is absolute (1e-6), so a vertex between those two (2e-7 or 8e-7 on a 0 … 1 curve) produced a piece with a zero knot range. Evaluating that piece panicked withZeroRangeand the whole body was left out.The reader now uses
max(TOLERANCE, span * 1e-7)for recognising a vertex at either end, for trimming and as the minimum piece range. Ranges are checked before cutting and again on each returned piece; a range that still cannot be evaluated is reported as a degenerate spline edge instead of panicking. The change stays in the STEP reader (crates/kernel/src/step_in/geom.rs).Before and after
The 43-line STEP from the issue (one planar face bounded by one closed degree-1 B-spline edge round a 20 mm square, vertex at parameter 2e-7),
solidcraft-cli eval closed-edge-vertex-after-start.step:Before (current
main), nothing is imported, so there is nothing to render:After (this branch): one body
square, 1 face (plane), 1 edge, area 400.0 mm², bounding box (0, 0, 0) … (20, 20, 0).solidcraft-cli snapshot closed-edge-vertex-after-start.stepon this branch: the 20 × 20 mm face is read, iso view.Tests
Two regression tests in the existing STEP reader test module:
Both fail on
mainand pass here.Validation (Linux x86_64)
cargo fmt --all -- --check: clean.cargo clippy -p solidcraft-kernel --all-targets -- -D warnings: clean.cargo test --profile ci -p solidcraft-kernel --lib -- step_in: 64 passed, 2 manual tests ignored.