pub fn shell_vector_areas(solid: &BrepSolid) -> VectorAreaReportExpand description
Does a closed shell’s boundary enclose the vector area it should — zero?
A patch’s vector area is a BOUNDARY integral,
∫_F n dA = (1/2) ∮_{∂F} r × dr, so the whole shell’s is a sum over the
faces’ loops. Every edge of a closed shell is walked exactly twice, once
each way, so Σ_faces ∫ n dA is exactly zero on a closed shell — a
statement about the RECORD, with no tolerance in it, as long as the two
faces meeting at an edge walk the same curve. They do not: each walks its
OWN TRIM, the pcurve mapped through its own surface, and what is left over
is the sum of every trim’s departure from the edge it claims.
That residual is the one whole-shell number that reads the trims — which
is what every mass property is actually an integral over
(geometry/pcurve.rs, PCURVE_REFINEMENT_TOLERANCE) — and nothing in the
kernel read it before 2026-09-16. validate() compares a pcurve to its
edge at pcurve_consistency (4e-3 on a small model, 2.5% of the diagonal
on a large one): three defects on the notched cap sat between 5e-7 and
1.9e-5, four orders inside that bar, and the solid’s volume matched its
closed form because two of them cancelled.
§The bar, and where it comes from
Write a trim as its edge plus a departure, r = e + d. Over a CLOSED loop,
(1/2)∮ r×dr − (1/2)∮ e×de = (1/2)∮ (e×dd + d×de) + (1/2)∮ d×dd
= ∮ d×de + (1/2)∮ d×dd(the middle step is one integration by parts: ∮ e×dd = −∮ de×d because
the loop closes). So a face whose every trim lies within δ of its edge
departs by at most δ · L, its own boundary length, and the second-order
term is δ²-small. Summing over a closed shell, whose faces walk every
edge twice, the strict bound is 2δ · Σ|e|.
δ is [PCURVE_REFINEMENT_TOLERANCE], 1e-7 — the 3D distance
fit_pcurve_on_surface refines a trim to, and the floor under every mass
property. The bar this module applies is the TIGHTER
δ · Σ|e| — half the strict bound — because the worst case it drops is a
shell where every pair of trims sits at the floor on OPPOSITE sides of
every edge all the way round. A shell between the two is named, and the
per-face bar says which faces put it there.
Two things the bar does not cover, both reported rather than absorbed:
- a fit that exited at
crate::PcurveFitExit::SampleCeilingnever reached the floor, so a shell carrying one can be over the bar and still be the best this kernel builds. That is a finding about the fit, not a reason to widen the bar. - the quadrature’s own error, reported per shell as
ShellVectorArea::quadrature_error. A residual inside its own error bar is not a measurement.
§What it does not ask
It does not ask whether a face’s trim is in the right PLACE — a trim
displaced along its own edge, or two faces’ trims displaced the same way,
cancel in this sum exactly as they cancel in the volume. It is a closure
test, not a fit test: d enters only through ∮ d×de. And it says
nothing about an open shell, where the residual is the boundary’s own
vector area and not a defect.