Module assemble

Source
Expand description

Assembling an exact boolean result from retriangulated operands.

§The three steps

  1. intersection_segments finds WHERE the two surfaces cross.
  2. retriangulate_face rebuilds each cut face so the curve exists as mesh edges.
  3. This module decides which of the resulting pieces to keep.

§Why step 2 makes step 3 easy

After retriangulation no triangle straddles the other solid’s surface: each one lies wholly inside or wholly outside. So a single containment test per triangle settles it, and the test can be taken at the centroid – a point guaranteed to be in the triangle’s interior, away from the boundary where classification is ambiguous.

Without step 2 this would be false: a triangle crossing the surface has no single answer, and sampling it anywhere would be a guess.

§Winding

Difference keeps the subject’s outside and the tool’s inside, but the tool’s kept faces must be REVERSED: they become the cavity wall, and a cavity’s outward normal points into the removed volume. Getting this wrong produces a mesh that looks right and has the wrong sign everywhere.

Functions§

exact_boolean
Compute a boolean of two interpenetrating solids, exactly.