roles.boolean
The exact boolean of two closed meshes that keeps persistent ids and roles, marking faces inside or outside and points on the seam.
Usage
Roles.boolean(a: VerbInput, b: VerbInput, op?: 'union' | 'intersection' | 'difference', scope?: string): Result<VerbValue>Parameters
aGeometry | VerbValueA closed polygon mesh, or an empty one; pass a VerbValue to keep its roles.
bGeometry | VerbValueA closed polygon mesh, or an empty one.
op'union' | 'intersection' | 'difference'The operation. Default
'union'.scopestringThe host node id new ids are minted under. Default
none: minted under 'boolean' with minter 0 (untrusted).
Returns
Ok with a VerbValue (the caller frees it); data has ref, contentHash, faces and points. With roles on an input, every face keeps its source face’s roles and is k:inside or k:outside the other operand, and every point the cut makes is k:seam.
Errors
Guarantees
- an empty operand (no faces, or none with three distinct positions) follows the set rules: A ∪ ∅ = A, ∅ ∪ B = B, A − ∅ = A, ∅ − B = ∅ and an intersection with ∅ is ∅, the surviving operand returned as given with Float64 positions
- faces keep their source face’s primId, so a host selection by id or role survives the renumbering
- an id that is not positive, or a point id that repeats in its operand, is keyed by its index, so what it mints gets minter 0, as does everything minted without a scope
- the same inputs, op and scope give the same ref and content hash
- The same result on every machine.
Example
Roles.boolean(Mesh.box().value, Mesh.box(Vector3.of(1, 1, 1), Point3.of(0.5, 0, 0)).value) // → a VerbValue once loadGeometryKernel() has run