Just in case: L-systems
In its simplest form, the formula is substituted in the axiom N times, where N is equal to the number of iterations. It turns out a long tape, on which construction takes place. The problem is that the size of the final "fractal" can vary quite seriously. I see only one way to fit the result into the viewport: build twice. The first time is to find out the maximum boundaries, the second one is to build with an adjusted length.
Is there a smarter way?
UPD:
Work example:
Angle π / 3 Axiom F
F-F ++ FF substitution
This is the Koch curve.
Iterations
- F-F ++ FF length 3F (since -F ++ F gives only half of its length due to rotation)
- F-F + + FF - F-F + + FF + + F-F + + FF - F-F + + FF length 9F
- length 27F well and so on
It's all easy. But there are formulas with branching or multilevel substitutions through other variables. Here it is already more difficult.