mesh.booleanDifference
The part of one closed mesh outside another, by the kernel’s exact boolean.
Usage
Mesh.booleanDifference(a: Mesh, b: Mesh): Result<Mesh>Parameters
aMeshThe mesh to cut from (closed, edge-manifold).
bMeshThe mesh to remove (closed, edge-manifold).
Returns
Ok with a closed, edge-manifold mesh; a when b has no faces; b (empty) when a has none.
Errors
Guarantees
- the result validate()s
- volume(result) = volume(a) − volume(a ∩ b)
- The same result on every machine.
Example
const a = Mesh.box().value, b = Mesh.box(Vector3.of(1, 1, 1), Point3.of(0.5, 0, 0)).value
const r = Mesh.booleanDifference(a, b) // → volume 0.5 once loadGeometryKernel() has run