Koch curve

Koch curve

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
lsystem KochCurve {
 
set symbols axiom = F - - F - - F;
set iterations = 5;
 
// normalize line length to have (result image will have always same size)
interpret F as DrawForward(2 ^ -(currentIteration * 3 / 2) * 512);
interpret + as TurnLeft(60);
interpret - as TurnLeft(-60);
 
rewrite F to F + F - - F + F;
}
 
process all with SvgRenderer;