{"id":49090983,"url":"https://github.com/zalo/ember-csg","last_synced_at":"2026-04-20T18:34:02.914Z","repository":{"id":349949580,"uuid":"1204628464","full_name":"zalo/ember-csg","owner":"zalo","description":"Open-source implementation of EMBER Integer Exact CSG (Nehring-Wirxel et al. SIGGRAPH Asia 2024)","archived":false,"fork":false,"pushed_at":"2026-04-08T09:24:28.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-08T09:33:38.259Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zalo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-08T07:18:22.000Z","updated_at":"2026-04-08T09:24:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zalo/ember-csg","commit_stats":null,"previous_names":["zalo/ember-csg"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/zalo/ember-csg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalo%2Fember-csg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalo%2Fember-csg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalo%2Fember-csg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalo%2Fember-csg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zalo","download_url":"https://codeload.github.com/zalo/ember-csg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalo%2Fember-csg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32059817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-20T18:34:02.281Z","updated_at":"2026-04-20T18:34:02.905Z","avatar_url":"https://github.com/zalo.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ember-csg\n\nAn open-source C++ implementation of **EMBER** (Exact Mesh Booleans via Efficient and Robust Local Arrangements), based on the paper by Nehring-Wirxel et al. from RWTH Aachen University.\n\n\u003e **Paper**: [EMBER: Exact Mesh Booleans via Efficient and Robust Local Arrangements](https://www.graphics.rwth-aachen.de/publication/03339/)\n\u003e\n\u003e Nehring-Wirxel, Nehring-Wirxel, Kobbelt. *ACM Transactions on Graphics (SIGGRAPH Asia 2024)*.\n\n## Overview\n\nEMBER performs exact Boolean operations (union, intersection, difference) on triangle meshes using integer homogeneous coordinates. All intermediate computation uses fixed-width integer arithmetic (up to 256 bits), ensuring bitwise-exact results with no floating-point robustness issues.\n\nThis implementation uses the `integer-plane-geometry` library from the [mesh-kernel](https://github.com/jnehringwirxel/mesh-kernel) project for the exact arithmetic foundation.\n\n### Features\n\n- **Exact integer arithmetic**: 26-bit positions, 55-bit normals, all intermediates ≤ 256 bits\n- **Plane-based geometry**: polygons defined by supporting plane + edge planes\n- **Face-local BSP**: pairwise intersection resolution via per-polygon binary space partitions\n- **WNV classification**: winding number vectors computed via robust multi-ray casting\n- **Boolean operations**: union, intersection, difference, symmetric difference\n- **OBJ I/O**: load and export triangle meshes\n\n### Validated Results\n\nComparison against manifold3d on sphere and cube meshes:\n\n| Operation | Volume Delta | Surface Area Delta |\n|-----------|-------------|-------------------|\n| Cube union | 0.00% | 0.00% |\n| Cube intersection | 0.00% | 0.00% |\n| Cube difference | 0.00% | 0.00% |\n| Sphere union | +3.16% | +2.45% |\n| Sphere intersection | -93.8%* | -92.3%* |\n| Sphere difference | +2.21% | +0.08% |\n\n*Sphere intersection accuracy is limited by BSP splitting on curved surfaces at the thin lens-shaped intersection region. Without subdivision, all sphere metrics match to within 0.02%.\n\n## Building\n\nRequires C++20, CMake 3.14+, and the mesh-kernel submodules (typed-geometry, clean-core):\n\n```bash\ncd mesh-kernel\ngit submodule update --init extern/typed-geometry extern/clean-core\n\ncd ../ember-csg\nmkdir build \u0026\u0026 cd build\ncmake .. -DCMAKE_BUILD_TYPE=Release -DCC_LINKER_MOLD=OFF\nmake -j$(nproc)\n```\n\n## Usage\n\n```cpp\n#include \u003cember/ember.hh\u003e\n\n// Create input meshes\nember::InputMesh mesh_a, mesh_b;\n// ... populate positions and triangles ...\nmesh_a.nsi = true;  // No Self-Intersections\nmesh_a.nnc = true;  // No Nested Components\n\n// Boolean union\nauto result = ember::boolean_union(mesh_a, mesh_b);\n\n// Export as OBJ\nauto soup = ember::triangulate_output(result);\nauto obj_string = ember::to_obj(soup);\n\n// Or load from OBJ\nauto loaded = ember::load_obj(\"input.obj\", /*nsi=*/true, /*nnc=*/true);\n```\n\n## Performance\n\n| Operation | Input Triangles | Time |\n|-----------|----------------|------|\n| Cube-Cube union | 24 | 71 ms |\n| Sphere-Sphere union | 1024 | 1.1 s |\n| Sphere-Sphere intersection | 1024 | 1.0 s |\n| Rounded cube (cube ∩ sphere) | 524 | 3.4 s |\n\nPerformance is dominated by the O(n²) pairwise intersection testing in leaf cells. The EMBER paper achieves 1.6ms for ~20K faces through work-stealing parallelism, K-DOP culling, and optimized splitting heuristics.\n\n## Current Limitations\n\n1. **Subdivision creates duplicate fragments**: When the kd-tree subdivision clips a polygon at a split boundary, both halves are independently classified. This can create redundant overlapping geometry. Disabling subdivision (setting `LEAF_THRESHOLD` high) produces exact results but is O(n²).\n\n2. **T-junctions at BSP boundaries**: BSP-split vertices may not align exactly with adjacent polygon edges, creating small gaps. The EMBER paper acknowledges this: *\"output not triangulated, contains T-junctions and convex polygons.\"*\n\n3. **Non-manifold output**: The OBJ export produces polygon soup without vertex sharing. Cube outputs become manifold after vertex merging; sphere outputs retain boundary edges from T-junctions.\n\n4. **No parallelism**: The current implementation is single-threaded. The paper's work-stealing architecture is not yet implemented.\n\n5. **No K-DOP culling**: All pairwise intersections are tested. K-DOP bounding volumes would skip many non-intersecting pairs.\n\n6. **WNV via multi-ray casting**: The paper uses exact segment tracing with 3-segment paths. This implementation uses double-precision multi-ray casting (7 rays with majority voting) for the final classification step, which is robust but not exact.\n\n## Architecture\n\n```\ninclude/ember/\n├── types.hh              Core geometry types (geometry\u003c26, 55\u003e)\n├── exact_classify.hh     Sign-extension-safe point-vs-plane classify\n├── polygon.hh            Convex polygon (support plane + edge planes)\n├── mesh.hh               Input/output mesh, coordinate scaling\n├── winding.hh            Winding number vectors, boolean indicators\n├── clip.hh               Polygon clipping against planes\n├── intersect_polygons.hh Pairwise polygon intersection (C1-C4 cases)\n├── local_bsp.hh          Face-local BSP tree\n├── segment_trace.hh      WNV classification via multi-ray casting\n├── subdivision.hh        Recursive adaptive subdivision\n└── ember.hh              Public API\n```\n\n## References\n\n- Nehring-Wirxel, Nehring-Wirxel, Kobbelt. *\"EMBER: Exact Mesh Booleans via Efficient and Robust Local Arrangements.\"* ACM Transactions on Graphics, 2024. [Project page](https://www.graphics.rwth-aachen.de/publication/03339/)\n- The `integer-plane-geometry` library from [mesh-kernel](https://github.com/juliusnehring/mesh-kernel/)\n- [typed-geometry](https://github.com/project-arcana/typed-geometry) for fixed-width integer arithmetic\n- [manifold3d](https://github.com/elalish/manifold) for comparison and validation\n\n## License\n\nMIT License. See [mesh-kernel](https://github.com/juliusnehring/mesh-kernel/) (also MIT) for the integer-plane-geometry foundation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzalo%2Fember-csg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzalo%2Fember-csg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzalo%2Fember-csg/lists"}