Skip to content

fix: mass properties on the caller's B-rep (#681 site 11) - #701

Merged
bherbruck merged 2 commits into
tangency-labs:mainfrom
erlis:fix/mass-properties-live-brep
Oct 24, 2026
Merged

bherbruck merged 2 commits into
tangency-labs:mainfrom
erlis:fix/mass-properties-live-brep

Conversation

@erlis

@erlis erlis commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Site 11 of the split agreed on #681: a B-rep copy where upstream works on the B-rep itself.

What. mass::integrator::properties::boundary built each face's oriented trim boundary on a whole-B-rep clone. Upstream's SmFace::ComputePreciseProperties (SmFace.cpp, a const member) calls CreateOrientedTrimBoundary(*GetContext(), TRUE, TRUE, ..) on the face itself, so the UV trim curves it makes, and the tolerances SetUVTrimCurve raises, stay on the B-rep. The copy is gone: face_properties, brep_properties and the SM_API entries built on them (face_area, face_centroid, brep_area, brep_volume, brep_mass_properties) take the caller's &mut Brep. Their bounding boxes (query::brep::calculate_bounding_box, which takes a LazyBrep) are computed on that B-rep too, so their edits persist as upstream's.

Callers updated: difftest mass_integrator and the solidcraft runner's measure (both own their B-reps), examples/primitives/checks.rs, tests/primitives_solid.rs. The key_of in boundary only names the owners of the returned copies and is unchanged.

Test. mass::integrator::properties::tests::face_area_makes_missing_uv_trims_on_the_callers_brep: a create_box box with its UV trims stripped; face_area of one face is 1 and the box has trims afterwards. On main the area is right but the trims stay on the copy (the trims are made on the box itself).

Checks (VM, base 20bef40): fmt; clippy with and without difftest/cpp; cargo test -p solidcore; wasm; cargo test -p difftest --features cpp; full difftest sweep vs the base: no case changes (206 PASS / 54 PARTIAL units on both sides, 0 failed). PASS mass.integrator cases=1528 passed=1528 failed=0 deferred=0 max_rel_err=0e0 before and after: each case integrates once, so the trims kept on the B-rep are not read again there. The change is about what the caller's B-rep holds afterwards, as upstream's does.

🤖 Generated with Claude Code

erlis and others added 2 commits October 23, 2026 21:12
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mass::integrator::properties::boundary built the oriented trim boundary
on a whole-B-rep clone per face, where upstream's
SmFace::ComputePreciseProperties builds it on the face itself: the UV
trims CreateOrientedTrimBoundary makes (and what comes with them) were
lost to the caller. face_properties, brep_properties and the SM_API
entries on top of them (face_area, face_centroid, brep_area,
brep_volume, brep_mass_properties) now take the caller's &mut Brep, and
the copy is gone. Their bounding boxes are computed on the B-rep too,
as upstream's.

Test: face_area_makes_missing_uv_trims_on_the_callers_brep (a box with
its UV trims stripped; fails on main: the trims stay on the copy).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@erlis
erlis marked this pull request as ready for review October 24, 2026 03:16
@bherbruck
bherbruck added this pull request to the merge queue Oct 24, 2026
Merged via the queue into tangency-labs:main with commit ff3f08c Oct 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants