From 4416a1276f1591b27acf20a8dd0e4573a8dbee6d Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Wed, 15 Apr 2020 14:01:22 +0800 Subject: [PATCH] add fern_leaf --- examples/lsystem3_collection.scad | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/lsystem3_collection.scad b/examples/lsystem3_collection.scad index 42b9fe2e..b968c71a 100644 --- a/examples/lsystem3_collection.scad +++ b/examples/lsystem3_collection.scad @@ -1,7 +1,7 @@ use ; use ; -for(line = tree()) { +for(line = fern_leaf()) { hull_polyline3d( [line[0], line[1]], thickness = 0.25, @@ -28,4 +28,15 @@ function hilbert_curve(n = 3, angle = 90, leng = 1, heading = 0, start = [0, 0, ["D", "|CFB-F+B|FA&F∧A&&FB-F+B|FC//"] ] ) - lsystem3(axiom, rules, n, angle, leng, heading, start); \ No newline at end of file + lsystem3(axiom, rules, n, angle, leng, heading, start); + +function fern_leaf(n = 8, angle = 4, leng = 1, heading = 0, start = [0, 0, 0]) = + let( + axiom = "EEEA", + rules = [ + ["A", "[++++++++++++++EC]B^+B[--------------ED]B+BA"], + ["C", "[---------EE][+++++++++EE]B&&+C"], + ["D", "[---------EE][+++++++++EE]B&&-D"] + ] + ) + lsystem3(axiom, rules, n, angle, leng, heading, start, forward_chars = "ABCDE"); \ No newline at end of file