Building a CAD Kernel in One Night
January 28, 2026Yesterday I posted vcad on Hacker News. It hit the front page. I was stoked.
Then I read the comments.
The Roast
"using a geometry kernel that operates on triangle meshes means this is a no-go for serious CAD usage" — nynx
"When you realize the bolt pattern is 2mm off, you just edit that dimension... constraint-based parametric systems already solve this" — etskinner
"systems like OpenSCAD seem to be practically incapable of doing anything related to surfacing" — dgroshev
"The pull request is to delete the project and open SOLIDWORKS or FreeCAD." — IshKebab
Triangle meshes. No constraints. No surfacing. Just delete it.
Fuck'm!
The shipped vcad used manifold — a mesh-based geometry kernel. Great for 3D printing. Not enough for real parametric CAD.
So I built a real one. Last night.
Mesh vs BRep
Here's the core issue. Watch this cylinder:
On the left: a mesh. Triangles approximating a curve. The more triangles, the smoother it looks — but it's always an approximation. Zoom in far enough and you'll see the facets.
On the right: a boundary representation. The cylinder isn't stored as triangles. It's stored as a mathematical surface — a parametric equation that defines every point exactly. The orange lines are UV parameter curves, showing how the surface can be evaluated at any resolution.
This matters because:
- Precision — a circle stays a circle, not a 64-gon
- Derivatives — you can compute exact normals, tangents, curvatures
- Intersection — two surfaces meet along a curve, not a jagged polyline
- Manufacturability — CNC machines speak G-code coordinates, not triangle meshes
Topology
BRep isn't just about smooth surfaces. It's about structure. Every solid has a hierarchy:
Vertices → Edges → Faces → Shells → Solids
Each vertex knows which edges touch it. Each edge knows which faces bound it. Each face knows its surface equation and its boundary loops. This connectivity is what makes operations like filleting and booleans possible.
In vcad-kernel-topo, every element has a unique ID and maintains bidirectional links to its neighbors. Modify one edge, and you can traverse the structure to find every affected face.
The Rolling Ball
One comment said mesh-based systems can't do surfacing. Here's why.
A fillet is created by rolling a ball along an edge:
The ball stays tangent to both faces. The path it traces becomes the fillet surface. Simple concept. Hard math.
With triangle meshes, there's no "edge" — just a crease between triangles. The ball has nothing smooth to roll against. You end up with a chamfered polygon, not a true fillet.
With BRep, the edge is a real curve. The faces are real surfaces. The ball rolls along the exact geometry, and you get a mathematically precise blend surface.
Booleans
When you subtract one shape from another, the kernel has to:
- Find where the surfaces intersect
- Split both shapes along that intersection curve
- Classify which parts are inside vs outside
- Sew the surviving faces into a new solid
Surface-surface intersection (SSI) is the dragon. Two NURBS surfaces can intersect in curves that branch, loop, and degenerate. My ssi.rs is ~500 lines of marching algorithms and Newton-Raphson refinement. She's ugly but she runs.
Constraints
"It's not parametric."
It is now. Parametric means constraints. You don't just draw geometry — you declare relationships. This line is horizontal. These two lines are equal length. This point lies on that circle.
The solver takes your messy sketch and finds positions that satisfy all constraints. Under the hood: Newton-Raphson on a system of nonlinear equations. Each constraint becomes an error function. Minimize total error. Done.
Now when you change one dimension, everything that depends on it updates automatically. That's the "parametric" in parametric CAD.
The Build
Comments hit around noon. By midnight: BRep kernel.
By this morning, manifold was gone. Ripped out. Deleted. The dependency that sparked all those comments? Gone.
Twelve crates. Pure Rust. Compiles to WASM.
vcad-kernel-math → vectors, transforms, tolerances
vcad-kernel-topo → vertices, edges, faces, shells, solids
vcad-kernel-geom → lines, planes, cylinders, NURBS surfaces
vcad-kernel-primitives → box, sphere, cylinder, cone, torus
vcad-kernel-tessellate → triangulation for export
vcad-kernel-booleans → surface-surface intersection, face classification
vcad-kernel-nurbs → spline curves and surfaces
vcad-kernel-fillet → rolling ball algorithm
vcad-kernel-sketch → extrude, revolve, profiles
vcad-kernel-constraints → geometric + dimensional solver
vcad-kernel-shell → shell, pattern, draft operations
vcad-kernel-wasm → browser runtime
Twelve hours. Coffee. Spite. Claude.
Why Not OpenCASCADE?
OpenCASCADE is 3.6 million lines of C++ with LGPL licensing and documentation that reads like a Soviet technical manual.
I wanted something I could understand, modify, and ship to WASM. Something with cargo test. Something mine.
The Vision
I'm not building a weekend project. I'm building a Fusion 360 replacement.
Open source. Self-hosted. No subscription. No cloud lock-in. No "we're sunsetting your pricing tier."
The roadmap:
| Phase | What | Status |
|---|---|---|
| 1-6 | Kernel: topology, booleans, NURBS, fillets, sketches | ✅ |
| 7 | Manifold rip-out, pure WASM | ✅ |
| 8 | Shell, pattern, draft | 🔨 |
| 9 | Constraint solver | ✅ |
| 10 | STEP import/export | 🔜 |
| 11 | Sweep, loft | 🔜 |
| 12 | Assemblies + joints | 🔜 |
The end state:
- Web app that runs entirely in your browser. No server. Your files stay yours.
- Desktop app for when you need native performance.
- CLI for scripting and CI/CD. Generate 1000 bracket variants from a CSV.
- API for when CAD is a step in your pipeline, not the whole pipeline.
Fusion charges $680/year and can't run without Autodesk's servers. Onshape is browser-based but your IP lives on their cloud. FreeCAD is free but... have you used FreeCAD?
I wanted something that didn't exist. So I'm building it.
The Timeline
Tue 1:30pm HN post hits front page
Tue 11:51pm first kernel commit
Wed 12:07am booleans working
Wed 12:31am NURBS done
Wed 1:22am fillets done
Wed 8:38am sketch + extrude done
Wed 9:10am manifold ripped out
Wed 9:27am constraint solver done
Wed 10:15am open sourced a SLAM library too
Ten hours from mass-criticism to mass-deletion. Then slamwich because why not.
Downvote this.
cargo add vcad
- Docs: docs.rs/vcad
- Source: github.com/ecto/vcad
- App: vcad.io
Go make something.
