perf(check): integrate a wall closed along u over its domain

Merged
RO
17h ago
+163-1

Summary

nurbs_face_over_domain integrates a face that is its whole B-spline surface directly over the surface's (u, v) domain, in panels between its knots. Besides open patches it takes a band closed along v, a blend round a closed rim, whose wire runs both closed sides and its seam once each way.

A wall turned a whole turn with the turn along u is closed along u instead. A full revolve of an ellipse or spline profile edge builds one like this (#2940). The domain path declined it, so it fell to nurbs_face_by_boundary, which projects every boundary point onto the surface.

Such a wall is now read through its transpose: the same surface with u and v swapped, whose normal points the other way, so its integrals come out the same under the opposite sign. closed_along_u_and_poleless is closed_along_v_and_poleless with the sides swapped.

For a profile of five lines and one ellipse arc turned a whole turn about z:

beforeafter
the wall's integral15 ms4.5 ms
solid_volume (mean of 50)24.8 ms2.65 ms
volume against the closed form4e-163e-15

The half turn's wall, already open, takes 3.2 ms either way.

Tests

a_wall_closed_along_u_is_read_over_its_domain builds a cylinder wall of radius 5 and height 10 as a rational B-spline, turned in quarters along u and, as a check, along v. It asserts:

  • both read over their domain, at the closed-form area and volume to 1e-12;
  • the two agree on the moments.

It fails without the change: the domain path returns None for the wall turned along u.

cargo test -p brepkit-check passes on this branch.

šŸ¤– Generated with Claude Code


Summary by cubic

Speeds up domain integration of NURBS walls closed along u, such as a full revolve's wall, which previously fell back to slower boundary projection. The surface is read as its transpose — u and v swapped, normal negated — so the integrals keep their sign. A wall's integral drops from 15 ms to 4.5 ms, solid_volume from 24.8 ms to 2.65 ms.

  • Adds a test that reads a cylinder wall turned in quarters along both u and v, asserting both integrate over their domain with matching area, volume, and moments; it fails before the change.