Skip to content
Dilara Caglar
CourseworkCompleted course assignment

Fabrication and Differentiable Geometry

Differentiable marching cubes, diffusion, a millability heuristic and a Fermat-spiral toolpath — printer simulation only.

My contribution

I implemented the cube-code computation and edge interpolation in a JIT-compiled JAX marching cubes, the DDPM pieces (reverse step, classifier-free guidance, a hand-written Adam), a C++ millability check with Eigen and libigl, and a Python G-code generator that fills an SVG outline with a Fermat spiral.

Affiliation
Computational Design of Cyber-Physical Systems
Dates
Spring 2026
Role
Individual assignment on course starter notebooks
Topics
Optimization and Simulation
Tools
JAX, Python
Contents
  1. The problem
  2. My contribution
  3. Constraints
  4. Design decisions
  5. What was difficult
  6. Evidence
  7. Current status
  8. What I would change next

01

The problem

Optimized and generated designs usually exist as continuous fields, not parts you can make. I worked on the full path to a physical object: extracting a mesh from a field so gradients can pass through it, generating new designs with a diffusion model, checking whether a part can be milled, writing 3D-printer toolpaths, and choosing a fabrication process for each part.

02

My contribution

I implemented the cube-code computation and edge interpolation in a JIT-compiled JAX marching cubes, the DDPM pieces (reverse step, classifier-free guidance, a hand-written Adam), a C++ millability check with Eigen and libigl, and a Python G-code generator that fills an SVG outline with a Fermat spiral. I also chose and justified a process for six parts. The course provided the mesh I/O, rendering, U-Net model and test harnesses.

03

Constraints

Each process brought physical limits: tool radius for milling (1 cm), nozzle and extrusion rate for printing, sheet thickness for water jetting. Computationally, the mesher had to stay differentiable and JIT-compatible, so branching code had to be expressed as masked array operations, and diffusion training ran on MNIST-scale data in Colab.

04

Design decisions

I wrote the vertex placement as linear interpolation along each edge so the mesh is differentiable with respect to both the scalar field and a deformation field. For the infill I chose a two-armed Fermat spiral with constant arc-length spacing so every segment extrudes the same amount of filament. For process selection I separated prototyping from production where it mattered, for example 3D printing to prototype a lattice part and injection molding to scale it.

05

What was difficult

Marching cubes gradients only move vertices along edges and cannot change topology, and they blow up where neighboring corner values are nearly equal, so I had to guard the division when v0 equals v1. The millability check also turned out to be a clearance heuristic rather than a true tool-access analysis, so I state its "millable" verdict with that caveat.

06

Evidence

The mesher passed JIT-versus-eager agreement, gradients matching central finite differences, and a watertight-sphere test, and it extracted the Stanford Bunny (112,900 faces) and a car model (250,340 faces). Diffusion training loss fell from 785.8 to 20.5, and guided sampling produced a legible digit for every class. The G-code loaded in a web printer simulator with uniform extrusion of 0.288 mm per segment, and the aluminum part (about 17,900 faces) was reported millable with a 1 cm tool.

07

Current status

Simulation and software. The toolpath was verified in a printer simulator; nothing in the submission shows it was printed physically.

08

What I would change next

I would replace the clearance check with a real tool-accessibility analysis, print the spiral infill to check adhesion and over-extrusion at the center, and connect the differentiable mesher to a shape-optimization loop instead of testing it in isolation.

Related work