Repository navigation
solidcore: a vertex's point on a closed face stays on its trims' side of the seam - #19780
Conversation
… of the seam A vertex use's UV point (`ComputeUVPoint`) is solved from a guess at its trims' end. On a closed surface the solve of a vertex a little off the surface can stop on the face's bound with a gap and cross the seam there: it lands a whole period from the guess, on the same surface point. On a face that ends on its surface's seam that point lies outside the face. `sm_FixUVTrimCurves` then moves the two trims meeting at the vertex onto it, a period across the face (`SmBrep::ValidatePointers` tests 70 to 72, "Edge endpoints within face domain", and test 82 on the vertex), and the vertex does not classify on its face (`SmFace` test 12). The answer is now moved by those whole periods back to the guess's side, with the seam wrap `face::p1` already uses for a loop's trims (WR-491). The closedness tests run only when the answer is more than half a natural length from the guess. Test: a cylinder wedge from -120 to 180 degrees read from STEP (the face is its NURBS form, ending on the form's seam), its top corner at 180 degrees 0.008 mm off the cylinder in a file of uncertainty 0.02 mm. Without the change the healed body fails tests 71, 71, 72 and 82; with it only the corner's gap is reported and `check_solid` passes.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Thanks, this reads well. I've approved the full CI run for it. The heavy checks were skipped on the last push, so could you push once more (an empty commit is fine) so the full suite runs on the new head? |
|
Thanks. The full run started on the current head when the label went on, so I have not pushed again: CI run 44668343574 on |
… and the seam check reports it (solidcore#3512) The wedge of tangency-labs#19780's test ends on its cylinder's seam at 180 degrees, and its side edge there runs from the seam at the bottom to the top corner, 1e-4 rad round past it: 10.008 sin(1e-4) = 1.0008e-3 mm across the seam. That is wider than the seam check's strip of 1000 * EFF_ZERO = 1e-9 mm. `has_near_misses` keeps the corner's tolerance as relief only while `coincident_span_lies_on_curve` does not prove that the edge's control polygon leaves the strip (`own_proof != Some(false)`). On main the cylinder's label stands half a turn off its NURBS form (this series' first change reads it in the form's frame), and `coincident_span_lies_on_curve` returns no proof either way for that edge (None, measured), so the corner keeps the relief and the report is empty. With the label read right it proves that the edge leaves the strip (Some(false)), and the cylinder, the one closed face, reports one "Face Near missing Seam" (SmFace test 36). The body is still valid (`check_solid` passes), and the report holds no other line. Test change: the report must hold that near miss exactly once. The old loop allowed only the corner's gap line; that allowance stays, though neither main nor this branch reports such a line. Co-Authored-By: Claude Code <noreply@anthropic.com>
An imported part whose face lies on a closed surface (a cylinder's or torus's NURBS form) and ends on that surface's seam could fail the kernel's check after import. The check reported
SmBrep::ValidatePointerstests 70 to 72 ("Edge endpoints within face domain") and test 82 on a vertex, because the trims at a vertex on that seam had been moved a whole turn across the face. The vertex's point on the face is now taken on its trims' side of the seam, the trims stay in the face's domain, and the pointer check passes.Found on an imported part that cannot be attached.
Change
solidcore/crates/solidcore/src/topology/vertexuse.rs,compute_uv_point(SMLib'sComputeUVPoint): the (u, v) point of a vertex use on its face. It guesses the point from its trims' ends, refines it with a local solve on the face's domain, and falls back to a global solve.Defect. On a closed surface, the solve for a vertex a little off the surface can stop on the face's bound with a gap and cross the seam there (
local_point_solve_1steps tocross_seam_uvs), or the global solve can answer on the other side. Either way it lands a whole period from the guess. That is the same surface point, but where the face ends on the seam it lies outside the face's domain. Two consumers then go wrong:create_uv_trim_curvescloses a small uv gap between the two trims meeting at the vertex withsm_FixUVTrimCurves, which moves both trims' ends onto the vertex's point. They jump a period, across the face and out of its domain (tests 70 to 72). The pointer check fails, so test 82's clearance proof for a vertex between the body's limit and twice it is never tried, andAssertValidis skipped.AssertValid's face test 12 classifies the point in (u, v) and finds it off the face.Where it shows: a body's trimmed surface cache is built on first use, and building it runs
create_uv_trim_curves. The ops check runs on a copy of the body, which carries no caches, so this happens inside the check of a freshly imported and healed body.Fix. The answer is moved by whole periods, in each closed direction, back to the guess's side. This is the seam wrap
face/p1.rsalready uses to join a loop's trims across a seam (WR-491,seam_wrap_of_gap, nowpub(crate)): a gap within 1% of a whole number of periods is that many periods. The guess is the trims' end, clamped to the face's domain. The closedness tests run only when the answer is more than half the surface's natural length from the guess in that direction, so every other call is unchanged.Not changed. The solvers,
sm_FixUVTrimCurves, and the check. An answer that is not a whole period from its guess is returned as before.Set aside.
sm_FixUVTrimCurvesonly. Tried: tests 70 to 72 pass, but face test 12 then fails on the same point.compute_uv_pointis the one place both read it from (vertex_face_gap's cached point is also its answer).The same three tests on another file were the subject of #19531 ("a loop once round a closed spline face lands in the surface's range", merged), a different cause:
close()ineval/pcurve.rsplacing a reader's loop a period past the surface's range. That PR and this one touch different files.Changes a default: no
Validation
New test
a_corner_off_a_face_where_it_ends_on_its_seam_is_on_the_face_and_its_trims_in_its_domain(solidcore/crates/solidcore-step/src/topology_tests.rs, beside the existing tests-70/71 test). It writes a STEP wedge of a cylinder of radius 10 mm and height 5 mm, from -120 to 180 degrees about +z, in a file of uncertainty 0.02 mm. Its top corner at the 180 degree side is 0.008 mm outside the cylinder, 1e-4 mm below the top and 1e-4 rad round past the side. The off-ruling edge's pcurve comes from the file'sProjectedtest kernel. Read, the cylinder face is its NURBS form, a turn from -180 degrees, with domain u [-1.3411, 2] (the form's seam at u = 2). The record is healed withBody::from_recordand checked atCheckLevel::All.AssertValidis skipped. The corner's UV point is (-2, 4.9999), a turn from its trims' end at (2, 4.9999).SmBreptests 1 and 3, "Bad Gap: Vertex/Face"), andcheck_solidpasses.On
mainat32efab6cf:cargo test --release --no-fail-fast, the six kernel packages:solidcore7,609 passed / 0 failed / 56 ignored (515 binaries);solidcore-ops978 / 0 / 11;solidcore-step166 / 0 / 2 (the new test among them);solidcore-convert58 / 0 / 0;solidcore-tess114 / 0 / 2;solidcore-record113 / 0 / 4.SOLIDCORE_REQUIRE_UPSTREAM=1):--all --goldensgives 283 units, 283 passed, 0 failed, 0 cases changed, added, removed or broken. With--all --digest-dir --digest-debug, all 283.debugfiles are byte-identical to those of a run of the same commit without the change, so no golden moves.cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo check -p solidcore --target wasm32-unknown-unknown,python3 scripts/ci/check_panic_sites.py --base upstream/main: clean. The panic-site script's only notice is about stale rows in files this change does not touch.check_solidfails withPointersInvalid(tests 70, 71, 72, and test 82 on vertices) at every check level. After, the pointer check passes, those vertices clear, andAssertValidruns. The same user's other STEP files give byte-identical check output before and after.Screenshots of the behavior (when observable)
None. The part this was found on cannot be attached, and the change is in a kernel check's input that a picture of the body would not show. The new test builds the same situation in code.
Integration status
Rebased onto
mainat a1608c0, which has #19531 and #19590 (no conflicts; no upstream change touches the three files here). On that head:cargo test --release --no-fail-fast -p solidcore-step: 167 passed, 0 failed, 2 ignored, the new test among them;cargo fmt --all --check: clean;mainat 7a8320c). On that previous head,cargo test --release --no-fail-fast -p solidcoregave 7,628 passed, 0 failed, 56 ignored (516 binaries).Goldens were compared digest by digest on
32efab6cf(above), and clippy, the wasm check and the panic-site check were run there, not again on the rebased head.Summary by CodeRabbit