{"_id":"@autarkis/chitin-lite","_rev":"3-ed06956189b8e76100b3cab722948660","name":"@autarkis/chitin-lite","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@autarkis/chitin-lite","version":"0.1.0","license":"MIT","_id":"@autarkis/chitin-lite@0.1.0","maintainers":[{"name":"autarkis","email":"autarkis@gmail.com"}],"homepage":"https://github.com/Autarkis/chitin#readme","bugs":{"url":"https://github.com/Autarkis/chitin/issues"},"dist":{"shasum":"f7c7e9daaa6099889fba660610c676028d4a26b5","tarball":"https://registry.npmjs.org/@autarkis/chitin-lite/-/chitin-lite-0.1.0.tgz","fileCount":12,"integrity":"sha512-Cev2nKEpYAMGitFKYTzetX2REsfR83YU3c8h2IEpoxzwU7EDof/rXDj1O/QOgjH8uHt+I2L5yEFLbL1Yx+5diw==","signatures":[{"sig":"MEUCIQDRrQhOne4x8lH/CWiXHt8mgbgaxD1Y69G2pJdWUer1OgIgRPSqtXWDNzWAJ6LfS57gMA96TUhsLh7yBnrC+pVd5NM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15320},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"51f26b455c01f6735643a90b6cfef40fef6769f4","scripts":{"test":"vitest run","build":"tsc"},"_npmUser":{"name":"autarkis","email":"autarkis@gmail.com"},"repository":{"url":"git+https://github.com/Autarkis/chitin.git","type":"git","directory":"integrations/wasm-lite"},"_npmVersion":"11.4.2","description":"Convex decomposition and .phys sidecar generation in the browser via CoACD WASM","directories":{},"_nodeVersion":"22.17.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.6","typescript":"^6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/chitin-lite_0.1.0_1784434191764_0.5006173880374192","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@autarkis/chitin-lite","version":"0.1.1","license":"MIT","_id":"@autarkis/chitin-lite@0.1.1","maintainers":[{"name":"autarkis","email":"autarkis@gmail.com"}],"homepage":"https://github.com/Autarkis/chitin#readme","bugs":{"url":"https://github.com/Autarkis/chitin/issues"},"dist":{"shasum":"a741087e3c366409f048e5b421e30bb40492b1b4","tarball":"https://registry.npmjs.org/@autarkis/chitin-lite/-/chitin-lite-0.1.1.tgz","fileCount":12,"integrity":"sha512-fGdmmlWMeoPeN+S87yANeJNKls+b28iq2W7A+ybTo1nj/4cgJdm/5c3ZqDF/tnNIW1KmqYuhC5K5Ox+9HZEJpg==","signatures":[{"sig":"MEQCIGWt3zqVk+o/9BzrQywRZMynIxLdzD5hT+5QksLyu0nzAiAwcRIZzAKDDCY4znjO1Dt+XiGITx0y2wXEC7T5NBJ90Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15209},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"feccb61b03dc4c8d2f3b277e2576c6d2ea16f89e","scripts":{"test":"vitest run","build":"tsc"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:73c5a590-aee5-44f1-ab0a-b2bd05e09fd6"}},"repository":{"url":"git+https://github.com/Autarkis/chitin.git","type":"git","directory":"integrations/wasm-lite"},"_npmVersion":"12.0.1","description":"Convex decomposition and .phys sidecar generation in the browser via CoACD WASM","directories":{},"_nodeVersion":"22.23.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.6","typescript":"^6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/chitin-lite_0.1.1_1784435825030_0.011196616094565126","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@autarkis/chitin-lite","version":"0.1.2","description":"Convex decomposition and .phys sidecar generation in the browser via CoACD WASM","keywords":["physics","collision","convex-decomposition","coacd","wasm","webassembly","convex-hull","mesh","gltf","collider","robotics","phys"],"homepage":"https://github.com/Autarkis/chitin#readme","bugs":{"url":"https://github.com/Autarkis/chitin/issues"},"repository":{"type":"git","url":"git+https://github.com/Autarkis/chitin.git","directory":"integrations/wasm-lite"},"type":"module","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"vitest run"},"devDependencies":{"typescript":"^6.0.3","vitest":"^4.1.6"},"license":"MIT","gitHead":"2f6f00102a98caa3251e27872786a6618e15e299","_id":"@autarkis/chitin-lite@0.1.2","_nodeVersion":"22.23.1","_npmVersion":"12.0.1","dist":{"integrity":"sha512-8rmb0EM0ZAhLVKlf/B14+RtYpoZo1g8kc6j44l4nVdfkTbFbZxRlVgadvEevqacC5DK9JbetYYgv17c4FiD2nw==","shasum":"e9d2b9d2fbf2ae2e06ac927ad4bba5bc166b9ad1","tarball":"https://registry.npmjs.org/@autarkis/chitin-lite/-/chitin-lite-0.1.2.tgz","fileCount":12,"unpackedSize":15534,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFzIh971Sun0SJlolyQpr5KoNheRGBAQavTo8SFwd668AiA3XXII3mFbEZfywq7I/Ju3DoCOHfhOJ/gvZ7RvWbiwfw=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:73c5a590-aee5-44f1-ab0a-b2bd05e09fd6"}},"directories":{},"maintainers":[{"name":"autarkis","email":"autarkis@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/chitin-lite_0.1.2_1784487257724_0.6941815326139755"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-19T04:09:51.662Z","modified":"2026-07-19T18:54:18.072Z","0.1.0":"2026-07-19T04:09:51.907Z","0.1.1":"2026-07-19T04:37:05.174Z","0.1.2":"2026-07-19T18:54:17.860Z"},"bugs":{"url":"https://github.com/Autarkis/chitin/issues"},"license":"MIT","homepage":"https://github.com/Autarkis/chitin#readme","repository":{"type":"git","url":"git+https://github.com/Autarkis/chitin.git","directory":"integrations/wasm-lite"},"description":"Convex decomposition and .phys sidecar generation in the browser via CoACD WASM","maintainers":[{"name":"autarkis","email":"autarkis@gmail.com"}],"readme":"# @autarkis/chitin-lite\n\nConvex decomposition and `.phys` sidecar generation in the browser. Takes mesh vertices + faces, runs CoACD via WebAssembly, and writes portable `.phys` files that any chitin consumer can read.\n\n## Setup\n\n```bash\nnpm install @autarkis/chitin-lite\n```\n\nYou also need the CoACD WASM module. Build it from `integrations/wasm/` or host the pre-built `coacd.js` + `coacd.wasm` alongside your app.\n\n## Usage\n\n### Initialize the WASM module\n\n```typescript\nimport { initFromUrl } from \"@autarkis/chitin-lite\";\n\n// Point to wherever you host the WASM build output\nawait initFromUrl(\"/wasm/coacd.js\", \"/wasm/coacd.wasm\");\n```\n\n### Decompose a mesh\n\n```typescript\nimport { decompose, writePhys } from \"@autarkis/chitin-lite\";\n\n// vertices: Float64Array (N*3), faces: Int32Array (M*3)\nconst result = await decompose(vertices, faces, {\n  threshold: 0.05, // concavity threshold (lower = more hulls, tighter fit)\n});\n\nconsole.log(`${result.hulls.length} convex hulls`);\n```\n\n### Write a .phys sidecar\n\n```typescript\nconst phys = writePhys(result.hulls);\n// phys is an ArrayBuffer -- save it, send it, or feed it to @autarkis/chitin-web\n```\n\n### Full pipeline: GLB to .phys in the browser\n\n```typescript\nimport RAPIER from \"@dimforge/rapier3d\";\nimport { initFromUrl, decompose, writePhys } from \"@autarkis/chitin-lite\";\nimport { parsePhys } from \"@autarkis/chitin-web\";\nimport { createColliders } from \"@autarkis/chitin-web/rapier\";\n\n// 1. Init WASM\nawait initFromUrl(\"/wasm/coacd.js\", \"/wasm/coacd.wasm\");\n\n// 2. Load mesh (from Three.js, your own loader, etc.)\nconst vertices = new Float64Array(geometry.attributes.position.array);\nconst faces = new Int32Array(geometry.index.array);\n\n// 3. Decompose\nconst result = await decompose(vertices, faces, { threshold: 0.05 });\n\n// 4. Write .phys\nconst physBuffer = writePhys(result.hulls);\n\n// 5. Read it back and create Rapier colliders\nconst physFile = parsePhys(physBuffer);\nconst { colliders } = createColliders(rapier, physFile);\n```\n\n## Config\n\n| Parameter | Default | Description |\n|-----------|---------|-------------|\n| `threshold` | 0.05 | CoACD concavity threshold. Lower = more hulls, tighter fit. |\n| `maxConvexHull` | -1 | Max hulls (-1 = unlimited). |\n| `prepResolution` | 50 | Preprocessing resolution. |\n| `sampleResolution` | 2000 | Surface sampling resolution. |\n| `mctsNodes` | 20 | MCTS tree width. |\n| `mctsIteration` | 150 | MCTS iterations per node. |\n| `mctsMaxDepth` | 3 | MCTS max search depth. |\n| `maxChVertex` | 256 | Max vertices per convex hull. |\n| `merge` | true | Merge small adjacent hulls. |\n\n## Constraints\n\nInput meshes must be manifold (watertight, no self-intersections). The WASM build excludes OpenVDB's manifold repair to keep the module under 600KB. OBJ, GLB, and STL files from standard modeling tools are typically manifold. If your mesh isn't, run it through a manifold repair tool first.\n","readmeFilename":"README.md","keywords":["physics","collision","convex-decomposition","coacd","wasm","webassembly","convex-hull","mesh","gltf","collider","robotics","phys"]}