Gyroid lattice cube
slice (TPMS section)
Marching-cubes triply-periodic minimal surface, sliced to reveal the iconic cross-section.
What it is
A cube filled with the triply-periodic minimal surface: sin(x)cos(y) + sin(y)cos(z) + sin(z)cos(x) = 0, thickened to a finite shell and clipped to a cube. Marching cubes generates the mesh from the implicit field; JSCAD’s polyhedron consumes it.
Why visual feedback matters
Implicit-surface design is invisible until you render it. Wall thickness, sampling resolution, and the relationship between cell size and bounding cube are all adjusted by looking. The slice tool reveals the gyroid’s famous interlocking S-curve cross-section — a section you can’t intuit from the formula alone. The first attempt used |f|-t as the iso-function, which has a kink at f=0 that breaks marching cubes; switching to f² - t² (same iso-surface, smooth field) immediately produced a coherent watertight mesh.
Screenshots
Iteration: low resolution → thick walls → final tuning at moderate threshold and high resolution.
Parameters
Parameters 4
| Name | Default | Description |
|---|---|---|
cellSize | 10 mm | Gyroid period. |
wallThreshold | 0.6 | Solid where `|f(x,y,z)| < t`. Larger = thicker walls. |
cubeSize | 40 mm | Outer cube size. |
resolution | 48 | Marching-cubes grid per axis. Higher = smoother, slower. |
Try it
- Open in your browser → openjscad.xyz, bundled single-file
- Source on GitHub →
- Full walkthrough on GitHub →