{"id":14981217,"url":"https://github.com/samalexander/three-csg-ts","last_synced_at":"2025-05-15T22:04:04.980Z","repository":{"id":40668667,"uuid":"189428601","full_name":"samalexander/three-csg-ts","owner":"samalexander","description":"CSG library for use with THREE.js","archived":false,"fork":false,"pushed_at":"2024-05-28T10:36:41.000Z","size":1492,"stargazers_count":534,"open_issues_count":3,"forks_count":29,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-01T03:34:53.733Z","etag":null,"topics":["computational-solid-geometry","csg","geometry","three-js","threejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/three-csg-ts","language":"TypeScript","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/samalexander.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["samalexander","manthrax"]}},"created_at":"2019-05-30T14:29:51.000Z","updated_at":"2025-03-24T20:07:37.000Z","dependencies_parsed_at":"2023-02-08T08:46:42.975Z","dependency_job_id":"f4290698-55aa-4252-82c6-257f3e9287ec","html_url":"https://github.com/samalexander/three-csg-ts","commit_stats":{"total_commits":139,"total_committers":6,"mean_commits":"23.166666666666668","dds":0.06474820143884896,"last_synced_commit":"f38d44cbc855a985a898b42761d52e3a0869e220"},"previous_names":["jiro-digital/three-csg-ts"],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samalexander%2Fthree-csg-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samalexander%2Fthree-csg-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samalexander%2Fthree-csg-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samalexander%2Fthree-csg-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samalexander","download_url":"https://codeload.github.com/samalexander/three-csg-ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247773719,"owners_count":20993639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["computational-solid-geometry","csg","geometry","three-js","threejs"],"created_at":"2024-09-24T14:03:09.613Z","updated_at":"2025-04-08T04:15:12.067Z","avatar_url":"https://github.com/samalexander.png","language":"TypeScript","funding_links":["https://github.com/sponsors/samalexander","https://github.com/sponsors/manthrax"],"categories":["TypeScript"],"sub_categories":[],"readme":"# three-csg-ts\n\nCSG (Constructive Solid Geometry) library for [three.js](https://github.com/mrdoob/three.js/) with Typescript support.\n\n_This is a typescript rewrite of [THREE-CSGMesh](https://github.com/manthrax/THREE-CSGMesh)._\n\n[Example](https://stackblitz.com/edit/three-csg-ts?file=index.ts)\n\n![Screenshot 2021-07-19 at 17 32 20](https://user-images.githubusercontent.com/935782/126194933-45ac18d0-2459-4213-97d2-d46ffb67483c.png)\n\n## Concept\n\nCSG is the name of a technique for generating a new geometry as a function of two input geometries.\n\nCSG is sometimes referred to as \"Boolean\" operators in 3d modelling packages.\n\nInternally it uses a structure called a BSP (binary space partitioning) tree to carry out these operations.\n\nThe supported operations are .subtract, .union, and .intersect.\n\nBy using different combinations of these 3 operations, and changing the order of the input models, you can construct any combination of the input models.\n\n## Installation\n\n- Install with npm `npm i -save three-csg-ts`\n- Install with yarn `yarn add three-csg-ts`\n\n## Example usage\n\n```ts\nimport * as THREE from 'three';\nimport { CSG } from 'three-csg-ts';\n\n// Make 2 meshes..\nconst box = new THREE.Mesh(\n  new THREE.BoxGeometry(2, 2, 2),\n  new THREE.MeshNormalMaterial()\n);\nconst sphere = new THREE.Mesh(new THREE.SphereGeometry(1.2, 8, 8));\n\n// Make sure the .matrix of each mesh is current\nbox.updateMatrix();\nsphere.updateMatrix();\n\n// Perform CSG operations\n// The result is a THREE.Mesh that you can add to your scene...\nconst subRes = CSG.subtract(box, sphere);\nconst uniRes = CSG.union(box, sphere);\nconst intRes = CSG.intersect(box, sphere);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamalexander%2Fthree-csg-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamalexander%2Fthree-csg-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamalexander%2Fthree-csg-ts/lists"}