Fractal Bézier
A smooth curve and a snowflake, drawn the same way.
Three points — a start, a control point and an end — define a quadratic Bézier curve. Cut the curve in half and each half is again such a curve, with a smaller triangle of its own. Replace every triangle by its two halves, again and again, and the line closes in on the curve. Replace it by other triangles, and the same procedure draws a fractal instead: the Koch snowflake, the Sierpiński arrowhead, a cathedral, a Christmas tree.
Pick a shape and change its rule: drag the corners of the triangles, add new ones or remove them, and the drawing follows. The drawing is made in your browser; the link keeps the rule, so it opens the same drawing again.
Level 5 · 3,072 pieces Version 1.2
The rule
The rule is a list of smaller triangles placed in the big one, and the big one can have any shape: the rule is written relative to it. In the editor the big triangle is the grey equilateral one, its start in the bottom left corner, its end in the bottom right and the control point at the top. Every small triangle has the same three roles, and its chord — the thick line from its start to its end, with an arrow — is what is drawn when it is done. At the next level each small triangle becomes the big one for its own copy of the rule.
The halves of the curve are two triangles: from the start to the middle of the curve, with the middle of the left arm as the control point, and from there to the end. Split a triangle of a smooth rule in half once more and it stays smooth — the curve is the same, cut finer. Move any corner off the curve and it becomes a fractal. Reversing a triangle runs it from its end to its start, so whatever grows on it comes out mirrored — except on a smooth rule, where a stretch of the curve run backwards is still the same stretch.
| Rule | Triangles | Drawing |
|---|---|---|
| Smooth | stretches of the big triangle's own curve, run either way, covering all of it | that Bézier curve |
| Chain | join end to end, from the start to the end | one continuous line, however jagged |
| Loose | do not join end to end | branches, or dust |
One curve is out of reach: the circle. Each step is an affine map, which turns a circle into an ellipse, so no fixed rule draws one exactly — the circle's own halves would have to change from level to level, closing in on the Bézier rule. The Wheel, found by hand, keeps within 1.4% of a circle on three arches, and up close it is a fractal.
The drawing
The rule starts from a base: one arch; three arches around a triangle, bulging outwards, where the Koch rule makes the snowflake; or two arches from the bottom corners up to a common top, mirror images of each other, which is how the Christmas tree gets two sides. The depth is the number of times the rule is applied. Triangles smaller than the detail of the picture are not split any further, and a level with too many pieces is not drawn at all, so a rule of seven triangles stops sooner than a rule of two.
It grew out of a short script from 2011 that wrote one drawing to a file. The shapes above were collected in it, most of them in 2014, and keep their old names, translated. The code is on GitHub: bsulkowski/fractal-bezier.