@vochsel/procgeo-js
v0.1.0
Published
Procedural geometry library inspired by Houdini SOPs — works in browser and Node.js
Downloads
63
Maintainers
Readme
@vochsel/procgeo-js
Procedural geometry library inspired by Houdini SOPs. Runs in the browser and Node.js via WebAssembly.
Install
npm install @vochsel/procgeo-js
# or
pnpm add @vochsel/procgeo-jsUsage
import init, { createBox, subdivide, computeNormals, smooth } from '@vochsel/procgeo-js';
await init();
const box = createBox({ size: [2, 2, 2] });
const subdiv = subdivide(box, { depth: 2, mode: 'catmullClark' });
const smoothed = smooth(subdiv, { iterations: 3, strength: 0.5 });
const geo = computeNormals(smoothed);
console.log(`${geo.numPoints} points, ${geo.numPrims} prims`);
// Export
const obj = geo.toObj(); // OBJ string
const glb = geo.toGlb(); // GLB Uint8ArrayThree.js Integration
import init, { createTorus, subdivide, computeNormals } from '@vochsel/procgeo-js';
import { toMesh, toWireframe, toPointCloud } from '@vochsel/procgeo-js/three';
await init();
const geo = computeNormals(subdivide(createTorus(), { depth: 2, mode: 'catmullClark' }));
scene.add(toMesh(geo));Available SOPs
Creation: createBox, createGrid, createSphere, createLine, createCircle, createTube, createTorus
Manipulation: transform, computeNormals, subdivide (linear + Catmull-Clark), smooth, polyExtrude, clip, reverse, scatter, copyToPoints, fuse, color, voronoiFracture
Geometry Methods: getPositions(), getTriangleIndices(), getNormals(), getColors(), toObj(), toGlb(), boundingBox(), numPoints, numPrims
Three.js Bridge: toBufferGeometry, toMesh, toWireframe, toPointCloud, toEdges, createScene
