From 23c3add62018d7edee779a8591441734dacc80b7 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 13 Apr 2020 21:15:33 +0800 Subject: [PATCH] add gosper_star --- examples/lsystem_collection.scad | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/lsystem_collection.scad b/examples/lsystem_collection.scad index 603b4f43..b95f9225 100644 --- a/examples/lsystem_collection.scad +++ b/examples/lsystem_collection.scad @@ -1,7 +1,7 @@ use ; use ; -for(line = weed()) { +for(line = gosper_star()) { line2d( line[0], line[1], @@ -152,6 +152,16 @@ function gosper_curve(n = 4, angle = 60, leng = 1, heading = 0, start = [0, 0]) ] ) lsystem2(rule, n, angle, leng, heading, start, "AB"); + +function gosper_star(n = 3, angle = 60, leng = 1, heading = 0, start = [0, 0]) = + let( + rule = [ + ["S", "X-X-X-X-X-X"], + ["X", "FX+YF++YF-FX--FXFX-YF+"], + ["Y", "-FX+YFYF++YF+FX--FX-FY"] + ] + ) + lsystem2(rule, n, angle, leng, heading, start); function levy_c_curve(n = 8, angle = 45, leng = 1, heading = 0, start = [0, 0]) = let(