Add robust boolean CSG kernel and Three.js bindings#9
Closed
aka-blackboots wants to merge 4 commits into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
union,intersection, anddifferencewith tunable numeric controls.OGBoolean) and a Three.js wrapper so the operation can be used from the existing@opengeometry/kernel-threeadapter and examples.Description
operations::booleanthat implements a BSP/plane-splitting CSG pipeline and exposes a wasm-bindgen classOGBoolean::compute(mesh_a, mesh_b, operation, constraints)which consumes and returns flat triangle buffers; numeric controlsepsilonandsnapare exposed for robustness (main/opengeometry/src/operations/boolean.rs).main/opengeometry/src/lib.rsto includepub mod boolean.BooleanShapewithBooleanOperation/BooleanConstraintstypes that callOGBooleanand convert betweenTHREE.Meshworld-space triangle buffers and kernel inputs/outputs (main/opengeometry-three/src/operations/boolean.tsandmain/opengeometry-three/src/operations/index.ts).import { BooleanShape } from '@og-three'(main/opengeometry-three/index.ts).main/opengeometry-three/examples-vite/operations/boolean.htmlandmain/opengeometry-three/examples-vite/src/pages/operations-boolean.ts) showing Cuboid vs Sphere with controls for operation,epsilon, andsnap.AI-DOCs/2026-03-04-boolean-operations-implementation.mddescribing changes, how to test locally and caveats (including that the referenced paper was not available in-container and how the implementation aligns with its robustness goals).Testing
cargo fmt --manifest-path main/opengeometry/Cargo.tomlandcargo test --manifest-path main/opengeometry/Cargo.toml; all kernel unit tests passed (existing tests + the new boolean unit test passed).vite --config ./vite.examples.config.mjs) and exercised the boolean example page and produced a screenshot, but runtime TypeScript imports require the wasm package (opengeometry/pkg/opengeometry) to be built first.npm run lint:checkreported pre-existing TypeScript lint errors unrelated to boolean changes and therefore failed;npm run build-threefailed in this environment because the wasm package is not present;npm run build-corecould not complete becausewasm-packis not installed in the execution environment.wasm-pack) are available.Codex Task