Expand description
Scalar reference implementation of solid booleans (ADR 0012, ADR 0017 §5).
§Why this exists
ADR 0012 requires a scalar reference to land before an optimized provider,
so conformance has something to be judged against. Booleans skipped that
step: axiolid-mesh-boolean-boolmesh arrived first and was, for a while, the only
definition of a correct result. A suite that only ever runs one
implementation cannot tell “correct” from “self-consistent”.
§What “reference” means here
Correctness first, speed never. This deliberately uses the most direct algorithm that can be reasoned about line by line, because its job is to be obviously right, not fast:
- Classification is by exact
orient3dsigns and ray parity, not by floating-point distance comparisons. - Work is
O(n·m)with no acceleration structure. A BVH would be a second thing to get wrong, and an oracle with its own bugs is worse than none.
§Independence
This shares no code path with boolmesh. It does not subdivide against the
other operand’s triangles; it classifies whole triangles by containment and
keeps or drops them. That makes it a genuinely independent implementation
for differential testing, at the cost of only being exact for operands whose
surfaces do not interpenetrate.
§Honest limits
ScalarBoolean refuses inputs it cannot answer exactly rather than
guessing. It reports GeomError::Unsupported when operand surfaces
properly intersect, because resolving that requires retriangulating along
the intersection curve – the hard part of a real boolean, and the part an
oracle must not fake. It is exact and total for:
- disjoint operands (all four operations),
- nested operands (one strictly inside the other),
- identical operands.
Those cases already pin the algebra: identity, annihilation, idempotence,
and containment. See tests/oracle.rs.
Structs§
- Scalar
Boolean - Portable scalar boolean reference.