Skip to main content

Module winding

Module winding 

Source
Expand description

Certificate that a closed oriented cycle’s winding number is 0 or 1 (#420, ADR 0099 D6).

axiolid_measure::cycle_volume_properties returns the integral of the surface’s integer winding number w, which is the enclosed volume only where w is 0 or 1: duplicated or overlapping shells count twice and an inverted shell subtracts. This module bounds how much volume breaks that.

§Moments of the winding number

The prism decomposition of crate::overlap needs no solid, only a closed oriented 2-cycle. Above a plane z = z0 below every vertex, the winding number at a point is the signed count of faces above it,

w = sum over faces f of  s_f * 1{ z0 < z < h_f(x, y) }

with s_f the sign of the face’s shadow f' (+1 facing up). Then

integral of w   = sum over f of     s_f * integral over f' of (h_f - z0)
integral of w^2 = sum over f, g of  s_f s_g * integral over f' and g' of (min(h_f, h_g) - z0)

The first is the signed volume and the second the unclamped pair sum behind intersection_volume, here of the mesh against itself over the faces as given (no flip of an inward-wound mesh, which would change the sign of w).

§The excess

w is an integer, so w^2 - w = w (w - 1) is 0 where w is 0 or 1 and at least 2 elsewhere. Hence

vol{ w not in {0, 1} }  <=  E := (integral of w^2 - integral of w) / 2
                             =   integral of w (w - 1) / 2

E weighs a point by w (w - 1) / 2, which is 0 at w = 0 or 1, 1 at w = -1 or 2 and 3 at w = 3: it equals the volume only where w is in {-1..2}, and a triple-welded unit cube has E = 3 over a bad volume of 1. E is 0 exactly when w is 0 or 1 almost everywhere. Both integrals are outward-rounded intervals, so the excess is an interval clamped below at 0; its upper end bounds the volume where the winding number leaves {0, 1}. The returned VolumeInterval brackets E, not that volume, so its “true volume” wording reads as E here. Edge-touching shells and a cavity (an inverted inner shell, w = 0 inside it) keep the excess at 0; a duplicated, overlapping or inverted shell makes it positive.

Enums§

WindingError
Why the winding number was not certified.

Functions§

certify_unit_winding
Certifies that the winding excess E = integral of w(w-1)/2 of a closed oriented cycle, an upper bound on the volume with w not in {0, 1} that equals it where w is in {-1..2}, is at most max_excess, and returns the bracket of E (upper <= max_excess; the interval’s “volume” is E, not the bad volume).