Skip to main content

boolean_dispatch

Function boolean_dispatch 

Source
pub fn boolean_dispatch(
    mesh_a: &ManifoldImpl,
    mesh_b: &ManifoldImpl,
    op: OpType,
    engine: BooleanEngine,
    token: Option<&CancelToken>,
) -> ManifoldImpl
Expand description

Route a boolean to the requested engine (types::BooleanEngine).

Auto is clean-by-default: it picks the faster Exact engine only when correctness is not at risk — i.e. when both operands are topologically manifold (not soup) and free of self-intersection — no two of an operand’s own triangles crossing, overlapping, or coinciding. Either condition failing routes the pair to Robust, because the exact engine’s kernels assume complete halfedge pairing and a non-self-intersecting surface; on self-intersecting-but-manifold inputs it silently mis-integrates the result (e.g. Thingi10K #92068’s triple-wound concentric shells).

The self-intersection test is cached per impl (see crate::robust::soup::has_self_intersections), so an operand pays for the scan at most once. Exact with a soup operand yields an empty result with Error::NotManifold (the guard inside boolean_with_token); no panic-catching is involved anywhere — dispatch is input-based only.