Blow a soap film across a wire frame and it pulls itself as tight as it can. Some of those taut films close up on themselves and repeat forever, tiling space in every direction like a crystal, and they divide what is left into two separate labyrinths that interlock and never meet. The gyroid is the famous one. It turns up in butterfly wings, in block copolymers, and in the stiffest lattices anyone has managed to 3-D print.
Pick one and it is built here, cell by cell, from a short trigonometric formula whose zero set traces the surface.
A minimal surface is one that cannot be made smaller by nudging it: pinch it anywhere and whatever you save in one direction you pay for in the other. Soap films do this for you. A triply-periodic one keeps doing it forever, repeating in all three directions, and the result cuts space into two labyrinths that thread through each other without ever touching. The two sides are shaded differently here, so the colour tells you which labyrinth you are looking into.
Schwarz found the first examples in the 1880s, by hand. Alan Schoen found twelve more at NASA in 1970, including the gyroid, which he worked out existed before anyone could draw it. Most of these have no formula you can write down in closed form.
From a trick. Take a short sum of sines and cosines and ask where it comes to exactly nothing. That set of points is a surface, and for the right sum it sits very close to the minimal surface you wanted. The gyroid's is three terms long:
sin x cos y + sin y cos z + sin z cos x = 0
These are called nodal surfaces, and the catch is in the word close: a nodal surface is an approximation, accurate enough to design a lattice with and not the same object a mathematician means by the gyroid. The page labels every surface that is one. The formulas are all published, and the sources are named below.
Level moves the target from zero to something else. The surface stops being minimal when you do — but it stays smooth and periodic, one labyrinth swells while the other shrinks, and this is exactly the knob a materials scientist turns to set the volume fraction of a gyroid lattice.
The formula is sampled on a grid, every little cube of that grid is cut into six tetrahedra, and wherever the formula changes sign along an edge the crossing point is found. Joining those gives the surface. Working in tetrahedra rather than cubes is what makes the result watertight without any special cases, and crossings are identified by the grid edge they sit on rather than by position, so the same point found from two directions is the same point and the surface never splits.
Only one cell is ever meshed. The formulas repeat exactly, so every other cell holds a copy, and the block is built by translating that one and welding the seams — the identical thing the generator does, measured there at some forty times faster than meshing the whole volume.
Thickness turns the sheet into a solid, offsetting it to either side and closing the edge. It is the setting that matters for printing: a surface of no thickness is not an object, and a slicer will make nothing of it. The sculpture on screen is the solid, so what you see is what the file contains.
Clip to a ball cuts the block to a sphere about its centre, as a fraction of its own half-width, so it keeps its meaning when you change the cell count. At 1 the ball has that half-width exactly and still bites the corners off; only 0 is off. The cut is solved for rather than approximated — where an edge of the mesh crosses the sphere, that crossing is found exactly — so the cut edge lies on the sphere and comes out smooth, instead of following the triangles in a staircase.
Rim tube sweeps a wire along the edge the clip opened. A periodic surface has no edge until you cut it, and a cut edge of a triangle mesh is a zigzag; the rim is smoothed first, by a method that attenuates the staircase without shrinking the curve off the surface it is meant to trace, and no point may move more than a quarter of the spacing, which holds it onto its corners. The wire then rests against the cut rather than being threaded onto it: a closed loop in space has no inside, so which way is out has to come from the surface, and it does — step from the average of each rim point's neighbours back out to the point itself, drop whatever runs along the rim, and what is left points across the edge and out of the sheet. Lift the tube along that by its own radius and it touches the edge and nothing else.
One more thing has to happen before the wire is swept: the rim is thinned. A rim traced off the sample grid has its points spaced by that grid, not by the tube, and where a curve turns inside its own radius a swept tube folds over itself — on a rim ten times finer than the tube, every step of the staircase becomes a crease, and the result looks like a caterpillar rather than a pipe. The cure is to drop points that sit closer together than about one and a half tube radii, never to move them: re-spacing the curve at equal steps would slide every point along its chords, off the corners it was traced from, and would do it even where the rim was already spaced comfortably wider than the tube. Choosing a subset cannot introduce that error — a point survives exactly where it was, or goes — and on a coarse rim nothing is dropped at all. The wire is part of the exported object, not decoration on the picture.
These are the lattices people actually print: a gyroid at a few cells across is strong in every direction at once and has no flat faces to peel. Give it a thickness, and Download STL scales the solid so its longest side is the size you ask for. If you leave the thickness at zero the export walls the sheet on the way out instead, by the millimetre figure beside it. A wall of a millimetre or two on a 150 mm block is the usual range; thinner than that needs resin.
Computed in your browser by a port of the project's TPMS engine, checked against it on every run of the site's tests: the formulas to a part in 1012, and the meshes triangle by triangle.