split_mesh_by_zones

Function split_mesh_by_zones 

Source
pub fn split_mesh_by_zones(
    host: &[Tri],
    zones: &[ZoneShape],
) -> Option<ZoneSplit>
Expand description

Split host into one solid per zone it reaches, plus the remainder.

host must be a closed orientable solid; the caller is responsible for that gate (in the viewer, the same GeometryClosure proof that gates a stated volume at all). Winding need not be outward: each operand is oriented before it enters the arrangement, exactly as subtract / intersection do.

Zones that cannot reach the host’s bounds are skipped without touching a triangle, so the cost is O(triangles x zones the element actually reaches).

Zones are expected to be pairwise non-overlapping, the same contract subtract_many states for its cutter group. Nothing forbids a user drawing overlapping zones, and the failure is not silent: overlapping pieces double-count, so ZoneSplit::sum_error_rel rises far above any floating point residue and the caller can refuse on it. That is the same signal the apportionment path reports as overlapping.

Returns None when host encloses no volume: no triangles, or a degenerate shell whose divergence sum is rounding residue (see NO_VOLUME_REL). There is nothing to split, and a ZoneSplit for it would carry one zero-triangle “remainder”, a sum_error_rel of zero and remainder_failed == false: every signal a caller gates on reading as a perfect split of nothing. The wasm entry drops malformed triangles before calling here, so an all-malformed input arrives as an empty host.