Chapter 12
Organic forms
Branches growing into one another, bones, a body as if kneaded from clay: such forms have no edges but flowing transitions. Surfaces from control points (chapter 5) and Boolean operations (chapter 7) only get there with a lot of effort. knotflow has a second way of describing shapes for them: implicitly.
The idea in two sentences
An implicit shape is a rule that says for every point in space how far it is from the surface: negative inside, positive outside. Two such shapes can be merged so that where they come close, a fillet grows, a soft rounding in the corner between them.
The result is a mesh, a net of triangles, not an exact solid of faces. For the printer that is just as good; what else it means is listed under the limits below.
Melting balls and rods

param fillet = 4 in 0..10 "size of the fillets [mm]"
param voxel = 0.5 in 0.2..2 "grid size [mm]"
let parts = [ball((0, 0, 12), 12),
ball((0, 0, 30), 8),
rod((0, 0, 16), (20, 0, 28), 2.5, r_end: 1.5),
rod((0, 0, 16), (-20, 0, 28), 2.5, r_end: 1.5)]
export blend(parts, k: fillet) |> isosurface(voxel: voxel) |> simplify color "sage"
Line by line:
ball(centre, r)is a ball,rod(from, to, r, r_end:)a rod that tapers from radius r tor_end. Both are implicit shapes, not triangles yet.blend(parts, k:)melts the parts together.kis the size of the fillet in mm; withk: 0(on the left in the picture) the parts meet with sharp edges.isosurface(voxel:)turns that into triangles. For this, space is divided into small cubes, the voxels;voxelis their edge length in mm.simplifymerges triangles where the surface is almost flat. Here 98,000 triangles become 22,000, and the shape moves by at most 0.02 mm.
Choosing the grid size
voxel decides how fine the result is and how long it
takes. Halve the grid size, and it takes about five times as long. Rules
of thumb:
- At most a third of the thinnest radius. Otherwise thin rods become angular or break apart.
- For printing, 0.2 to 0.5 mm is usually enough; finer than the nozzle rarely pays.
- Try coarse first (
voxelas aparam), compute fine at the end. In the browser the preview uses twice the grid size anyway (chapter 13).
Groups: hard inside, soft between
Each element of the list for blend is a
group. A group can itself be a list; its parts are
joined hard, without a fillet. The rounding only grows between
groups:
let arm = [rod((0, 0, 0), (10, 0, 10), 2), rod((10, 0, 10), (25, 0, 12), 2)]
let body = [ball((0, 0, 0), 8)]
export blend([arm, body], k: 3) |> isosurface(voxel: 0.4)
You need this when a strand is made of many short rods: if each piece melted softly into the next, every seam would get a small bulge.
simplify: fewer
triangles
simplify(mesh, tol:) removes triangles as long as the
surface stays within tol mm (default 0.02) of the original:
many in flat areas, few where it curves strongly. Closed solids stay
closed. In the browser the Triangles checkbox shows
where triangles were merged.
- A larger
tolgives smaller files and faster slicers; more than a tenth of a millimetre shows in the print, though. tol: 0only merges triangles that lie exactly in one plane, without any deviation.- The browser's preview skips
simplify; the STL is always simplified.
Fields: shapes in the plane
For flat parts the same principle exists in 2D, with fields: a grid with one number per cell, like a picture.

param k = 10 in 0.5..20 "size of the transition [mm]"
let g = grid((-40, -30), (40, 30), 0.5)
// smooth minimum of two distance fields: merges two shapes with a rounding of size k
fn smin(a, b, k) = min(a, b) - h * h * k / 4
where h = max(k - abs(a - b), 0) / k
let left = sdf(circle(15) |> move(x: -15), g)
let right = sdf(circle(10) |> move(x: 14), g)
export plate(-smin(left, right, k), level: 0, thickness: 3) |> simplify
grid(from, to, cell)is an empty field over a rectangle, here with cells of 0.5 mm.sdf(curve, grid)gives for every cell the distance to a closed curve, negative inside. The name stands for signed distance field.ballandroddescribe their shapes in 3D exactly like this.- You compute with fields as with numbers, cell by cell:
min,max,abs,+,*… The smooth minimumsminis likemin, but rounds the transition with size k. That is also howblendmelts shapes in 3D. plate(field, level:, thickness:)makes a plate where the field is abovelevel. Hence-smin(…): the inside should be positive.
More tools for fields: step(x) (1 where x > 0, else
0), blur(field, r) (soften),
xs(g)/ys(g) (the coordinates of every cell),
mean. A picture from a PNG file is a field too (chapter
11).
Letting it carry: statics and finite elements
Organic shapes often look the way they do because they grew: where much load flows there is material, where there is none it is missing. knotflow can compute this. Statics asks which forces act in a structure when it is loaded. From that follows how thick each part must be.

param span = 80 in 40..160 "span [mm]"
param panes = 6 in 2..12 "panels"
param rise = 14 in 5..40 "height [mm]"
let w = span / panes
let bottom = [(w * i, 0, 0) | i <- range(panes + 1)]
let top = [(w * (i + 0.5), 0, rise) | i <- range(panes)]
let nodes = bottom ++ top
let n = panes + 1
let bars = [(i, i + 1) | i <- range(panes)] ++ [(n + i, n + i + 1) | i <- range(panes - 1)]
++ [(i, n + i) | i <- range(panes)] ++ [(i + 1, n + i) | i <- range(panes)]
let sized = frame_sizing(nodes, bars, [0, panes], (0, 0, -1), r_min: 0.6, r_max: 2.4)
let rods = [rod(nodes[i], nodes[j], sized.radii[k]) | (k, (i, j)) <- enumerate(bars)]
export blend(rods, k: 1.5) |> isosurface(voxel: 0.4) |> simplify color "sage"
nodesare the nodes,barsthe rods as pairs of node numbers: a chord at the bottom, one at the top, diagonals between them.frame_sizing(nodes, bars, supports, load, r_min:, r_max:)computes the structure: nodes0andpanes(the two ends at the bottom) rest on supports, the load(0, 0, -1)presses on every node, the dead weight. Every rod gets a radius betweenr_minandr_max, depending on how much it is stressed; the result is a record{radii, stress}.- Thick rods are stiffer and attract more load. So
frame_sizingrepeats the computation a few times (rounds) until the radii hardly change. blendmelts the rods, fillets grow at the nodes: the truss looks grown.
For flat parts the same exists with fields:
analyze_plane(density, shape, supports, cases) computes
with finite elements. The area is divided into small
cells, each cell follows a simple rule for how it deforms under force,
and all together give a large system of equations. What comes out is the
strain energy per cell: high where the material works,
low where it is only carried along. The example bone lets a
bone grow with it: material is added where the energy is high and
disappears where it is low.
voronoi_sphere(points) gives matching nets: the points
divide a sphere into Voronoi cells, each cell holding
everything that is closest to its point. The cells' edges are the rods,
their corners the nodes. The example voronoi_sphere sizes
them with frame_sizing and melts them as above.
How the computations work inside: lesson 3.13 (finite elements, bone) and lesson 3.14 (truss, Voronoi).
Limits
- A mesh takes no part in
union,differenceandintersection: "union: a must be a surface or a solid, got a mesh". Everything that is to melt together therefore belongs in the sameblend. Meshes may of course stand next to other things as separate exports. move,rotate,scaleandscatter(chapter 10) work with meshes.- Implicit shapes only know balls and rods. Other basic shapes are built from them, such as a curve as a chain of short rods in one group.
- Fine grids need time and memory: halving
voxelmakes it about five times slower.
The gallery for orientation
These examples show what the building blocks can do. They are larger
than the models above; read them from the bottom up, starting at the
export.
| Example | Technique |
|---|---|
| fork | three rods melted into a forked branch, with and without
simplify |
| tree_roof | tree columns, branching recursively, each crown one
blend |
| voronoi_sphere | several Voronoi nets on a sphere, the rods thick and thin after a structural analysis, melted at the nodes |
| romanesco | self-similarity without implicit shapes: cones of cones of cones, on a spiral |
| bone | a thigh bone in section that grows by a remodelling rule: fields and finite elements |
| facade | no implicit shape, but grown parametrically: the fins of a facade
opening towards a point (frame_on, place) |
How implicit shapes are cut into triangles and what
simplify does is explained in lesson 3.12, the bone in
lesson 3.13 and
the tree supports, Voronoi spheres, Romanesco and facade in the gallery (lesson 3.14).