Skip to content

solidcore: a vertex's point on a closed face stays on its trims' side of the seam - #19780

Merged
bherbruck merged 1 commit into
tangency-labs:mainfrom
jkkicks:kernel-vertex-uv-point-stays-on-its-trims-side-of-a-seam
Nov 20, 2026
Merged

bherbruck merged 1 commit into
tangency-labs:mainfrom
jkkicks:kernel-vertex-uv-point-stays-on-its-trims-side-of-a-seam

Conversation

@jkkicks

@jkkicks jkkicks commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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::ValidatePointers tests 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's ComputeUVPoint): 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_1 steps to cross_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_curves closes a small uv gap between the two trims meeting at the vertex with sm_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, and AssertValid is 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.rs already uses to join a loop's trims across a seam (WR-491, seam_wrap_of_gap, now pub(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.

  • Putting the vertex's point on the trims' sheet inside sm_FixUVTrimCurves only. Tried: tests 70 to 72 pass, but face test 12 then fails on the same point. compute_uv_point is the one place both read it from (vertex_face_gap's cached point is also its answer).
  • Keeping the surface solvers' seam crossing inside a domain that does not span the period. That is deep in the solver's port and reaches every point solve, not only vertex points.
  • Relaxing tests 70 to 72: the trims really did leave the face.

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() in eval/pcurve.rs placing 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's Projected test 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 with Body::from_record and checked at CheckLevel::All.

  • Without the change, the check fails tests 71, 71, 72 and test 82 (offset 0.01600125, tolerance 0.01), and AssertValid is skipped. The corner's UV point is (-2, 4.9999), a turn from its trims' end at (2, 4.9999).
  • With it, the corner's point is (2, 4.9999). The check reports only the corner's own gap off the cylinder (SmBrep tests 1 and 3, "Bad Gap: Vertex/Face"), and check_solid passes.

On main at 32efab6cf:

  • cargo test --release --no-fail-fast, the six kernel packages: solidcore 7,609 passed / 0 failed / 56 ignored (515 binaries); solidcore-ops 978 / 0 / 11; solidcore-step 166 / 0 / 2 (the new test among them); solidcore-convert 58 / 0 / 0; solidcore-tess 114 / 0 / 2; solidcore-record 113 / 0 / 4.
  • Goldens with upstream's test files (SOLIDCORE_REQUIRE_UPSTREAM=1): --all --goldens gives 283 units, 283 passed, 0 failed, 0 cases changed, added, removed or broken. With --all --digest-dir --digest-debug, all 283 .debug files 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.
  • The STEP import of the part this was found on: before, check_solid fails with PointersInvalid (tests 70, 71, 72, and test 82 on vertices) at every check level. After, the pointer check passes, those vertices clear, and AssertValid runs. 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 main at 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;
  • the part this was found on and the same user's other STEP files: check output identical to the run on the previous rebase (main at 7a8320c). On that previous head, cargo test --release --no-fail-fast -p solidcore gave 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

  • Bug Fixes
    • Improved handling of geometry near cylindrical boundaries and seams during file import. Certain shapes that previously produced incorrect topology or failed solid checks can now be read and validated more reliably.

… 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.
@jkkicks
jkkicks requested a review from a team as a code owner November 20, 2026 03:22
@jkkicks
jkkicks requested review from jyviko and removed request for a team November 20, 2026 03:22
@github-actions github-actions Bot added the area:kernel B-rep kernel, booleans, blends, STEP/IGES label Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Edge-vertex UV projections now wrap toward the trim-side guess when a closed surface direction meets the specified period conditions. A cylindrical wedge regression test checks STEP reading, topology, gap reports, and solid validation.

Changes: UV Seam Wrapping

Layer / File(s) Summary
Wrap edge-vertex UV projections
solidcore/crates/solidcore/src/topology/face/p1.rs, solidcore/crates/solidcore/src/topology/vertexuse.rs
uv_point_in checks for qualifying closed surface directions and uses seam_wrap_of_gap to wrap the projection toward the trim-side guess.
Verify cylindrical wedge reading
solidcore/crates/solidcore-step/src/topology_tests.rs
A regression test reads a cylindrical wedge STEP solid at 0.02 mm uncertainty. It checks read success, topology counts, vertex/face gap reports, and solid validation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: Minimal · up to 1b04a

This change keeps a vertex's UV point on the same side of a closed face's seam as its trims. This fixes pointer and face-check failures in a STEP import case. No concrete defect was established in the change. Whether the corrected point can sit tolerance-scale past the seam bound without tripping later checks was not confirmed either way. It looks safe to merge.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the change: a vertex's point on a closed face is kept on its trims' side of the seam. It matches the vertexuse.rs compute_uv_point change described in the summary and objectives. It is…
Description check Passed The description follows the template. It has a Change section that explains the defect, the fix, and what was deliberately not changed. It states 'Changes a default: no' as the template requires. It i…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Existing Defaults Unchanged Passed The check is about UX defaults: default settings or preferences, command behaviour in normal use, UI layout or behaviour, and shortcuts. Per the check's own wording, kernel or geometry result changes …
Full details: Title check

Explanation

The title names the change: a vertex's point on a closed face is kept on its trims' side of the seam. It matches the vertexuse.rs compute_uv_point change described in the summary and objectives. It is specific to the solidcore kernel, and a teammate scanning history would understand the main change. Length is 81 characters, slightly above a short title, but it is still a single clear sentence.

Full details: Description check

Explanation

The description follows the template. It has a Change section that explains the defect, the fix, and what was deliberately not changed. It states 'Changes a default: no' as the template requires. It includes a Test change line? No: the change adds a test and changes no existing test or golden expectation, so no test change line is needed. The Validation section gives commands, measured results, and expected values for the geometry behaviour. The Screenshots section explains why none are provided. The Integration status section records the upstream commit, rebase, and validation after integration. The description is plain-worded and mostly self-contained. Minor gaps: the Change section opens with the defect rather than a plain-language statement of who the tool is for, and it relies on internal names such as SMLib, WR-491, and tests 70 to 72 without much definition for a newcomer. The screenshot justification is reasoned but the template asks for a before/after picture where observable, so a reviewer may want a small reproduction video or output for the wedge case.

Full details: Existing Defaults Unchanged

Explanation

The check is about UX defaults: default settings or preferences, command behaviour in normal use, UI layout or behaviour, and shortcuts. Per the check's own wording, kernel or geometry result changes under solidcore/ are not changed defaults and pass. The changed-file inventory for the reviewed range has three modified files, all under solidcore/: - solidcore/crates/solidcore-step/src/topology_tests.rs: adds a regression test. - solidcore/crates/solidcore/src/topology/face/p1.rs: changes seam_wrap_of_gap from private to pub(crate). - solidcore/crates/solidcore/src/topology/vertexuse.rs: changes uv_point_in/compute_uv_point so that a vertex's UV point stays on its trims' side of a closed seam. No settings, preferences, CLI or UI behaviour, shortcuts, or default layouts are touched. The PR description states "Changes a default: no", and nothing in the diff contradicts that. The behaviour change is a kernel geometry/topology result (which UV point a vertex use gets, and whether a previously failing STEP import now passes its pointer check). Under the check's rules, that does not count as a changed UX default.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 716eaef and 1b04a65.

Files selected for processing: 3

  • solidcore/crates/solidcore-step/src/topology_tests.rs
  • solidcore/crates/solidcore/src/topology/face/p1.rs
  • solidcore/crates/solidcore/src/topology/vertexuse.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@bherbruck bherbruck added the approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) label Nov 20, 2026
@bherbruck

Copy link
Copy Markdown
Collaborator

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?

@jkkicks

jkkicks commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. The full run started on the current head when the label went on, so I have not pushed again: CI run 44668343574 on 1b04a65 has SolidCore checks (tests), kernel rig and goldens, and Native Linux tests in progress now. If you would still like a fresh push once it finishes, say so and I will add one.

@bherbruck bherbruck added the ready to merge reviewed, every ask addressed; merge once CI is green label Nov 20, 2026
@bherbruck
bherbruck added this pull request to the merge queue Nov 20, 2026
Merged via the queue into tangency-labs:main with commit 4e39ecd Nov 20, 2026
128 checks passed
MarkusReichart added a commit to MarkusReichart/solidcraft that referenced this pull request Dec 3, 2026
… 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) area:kernel B-rep kernel, booleans, blends, STEP/IGES ready to merge reviewed, every ask addressed; merge once CI is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants