{"id":46095162,"url":"https://github.com/robonrrd/csg","last_synced_at":"2026-03-01T18:34:43.815Z","repository":{"id":90577379,"uuid":"221058046","full_name":"robonrrd/csg","owner":"robonrrd","description":"Constructive solid geometry library","archived":false,"fork":false,"pushed_at":"2021-01-29T00:52:06.000Z","size":338,"stargazers_count":24,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-01-29T07:32:58.586Z","etag":null,"topics":["csg","geometry","modeling"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robonrrd.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}},"created_at":"2019-11-11T19:50:10.000Z","updated_at":"2023-11-06T14:00:27.000Z","dependencies_parsed_at":"2023-03-03T09:00:28.677Z","dependency_job_id":null,"html_url":"https://github.com/robonrrd/csg","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.5517241379310345,"last_synced_commit":"558f092c4e73daebf9b43ce70d4f2c96f32626e5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/robonrrd/csg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robonrrd%2Fcsg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robonrrd%2Fcsg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robonrrd%2Fcsg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robonrrd%2Fcsg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robonrrd","download_url":"https://codeload.github.com/robonrrd/csg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robonrrd%2Fcsg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29978845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["csg","geometry","modeling"],"created_at":"2026-03-01T18:34:43.295Z","updated_at":"2026-03-01T18:34:43.804Z","avatar_url":"https://github.com/robonrrd.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libCSG - A constructive \"solid\" geometry library #\n\nThis is a clean re-implementation of work I did years ago at a visual effects company.  This library implements the three core CSG operations (intersection, union, and difference) on triangulated meshes.  Unlike typical CSG implementations, the meshes to\nbe operated on do not need to be solid (*i.e.* watertight) or even manifold.\n\n## Current Status ##\n### May 4, 2020 ###\nAll major pieces of functionality are working in limited tests.  Only\n'difference' operations are currently supported, with or without watertight\n\"capping.\"  Intersection and union operations are variations of the existing\ncode, but I want to do more debugging and optimizations before implementation.\nNo support for preserving normals or UVs.  Poor handling of edge and corner\ncases.  Output is a triangulated mesh, with the \"triangle sliver\" problem that\ncomes along with that.\n\n\n## Dependencies ##\nRequires [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page#Download).\n\nIn my previous implementation, I used a propietary retriangulation algorithm to break up\nthe cut triangles. However, for this public implementation I am using\n[Jonathan Shewchuk](https://people.eecs.berkeley.edu/~jrs/)'s excellent\n[Triangle](http://www.cs.cmu.edu/~quake/triangle.html) library. This code is free for\npersonal and research use but not for commercial use, and does not fall under the\nlicense that the rest of this code uses.\n\nIf you wish to create the Python bindings or the Blender integration,\n[SWIG](http://www.swig.org/) also must be installed.\n\n## To Build ##\nIn the top-level ```csg``` directory:\n```\nmkdir build\ncd build\ncmake ..\nmake\n```\n## To Use in Blender ##\nAfter making the project, as described above, run ```make install``` to install the DSOs into your local Python 3.6 site packages. Then, in Blender, go to 'User Preferences' and select 'Install Addon From File.'  Install the ```csg.py``` file, found in the ```blender``` directory and enable it (by clicking the empty square next to the name).  To use the CSG tool, select two triangulated meshes: the clay first, then the knife. Execue the CSG operation (space bar, then type 'CSG') and two triangulated meshes will be created: one for the portion of the clay mesh above the knife, one for the portion of the clay mesh below the knife.\n\n## Explanation of the Algorithm ##\nEssentially, the CSG algorithm finds all intersections of the triangles in mesh \"A\" and\nmesh \"B\", retriangulates the intersected faces to preserve these new edges, and then\nseperates the cut mesh (what we called the \"clay\") into two new meshes.\n\nIn more detail:\n1. Create AABB trees of the two meshes (the \"clay\" and the \"knife\").\n2. Using the AABB trees, do a broadphase intersection step to find pairs of\nbounding boxes that may contain intersecting triangles\n3. Determine exact triangle-triangle intersections, yeilding potentially new\npoints that describe new edges.\n4. Retriangulate the cut triangles with any added points and edges from step 3.\n5. Categorize the cut triangles into two new surfaces, based on whether they\nare above or below the face that cut them. We then flood-fill the membership among\nthe uncut triangles.\n6. Generate the output meshes by combining the four mesh fragment results (clay above the knife, clay below the knife, knife above the clay, knife below the clay) in\nvarious ways, depending on the operation we desire.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobonrrd%2Fcsg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobonrrd%2Fcsg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobonrrd%2Fcsg/lists"}