diff --git a/examples/lsystem2_collection.scad b/examples/lsystem2_collection.scad index e6129d1f..2276ca45 100644 --- a/examples/lsystem2_collection.scad +++ b/examples/lsystem2_collection.scad @@ -1,7 +1,7 @@ use ; use ; -for(line = tree()) { +for(line = fern()) { line2d( line[0], line[1], @@ -11,6 +11,17 @@ for(line = tree()) { ); } +function fern(n = 8, angle = 4, leng = 1, heading = 0, start = [0, 0]) = + let( + axiom = "EEEA", + rules = [ + ["A", "[++++++++++++++EC]B+B[--------------ED]B+BA"], + ["C", "[---------EE][+++++++++EE]B+C"], + ["D", "[---------EE][+++++++++EE]B-D"] + ] + ) + lsystem2(axiom, rules, n, angle, leng, heading, start, forward_chars = "ABCDE"); + function tree(n = 2, angle = 36, leng = 1, heading = 0, start = [0, 0]) = let( axiom = "F",