mesh.booleanDifference

The part of one closed mesh outside another, by the kernel’s exact boolean.

GeometricSince 0.3.0

Usage

TypeScript
Mesh.booleanDifference(a: Mesh, b: Mesh): Result<Mesh>

Parameters

  • aMesh

    The mesh to cut from (closed, edge-manifold).

    Required

  • bMesh

    The mesh to remove (closed, edge-manifold).

    Required

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

TypeScript
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

See also