diff options
Diffstat (limited to 'testdata/scad/features/module-recursion.scad')
-rw-r--r-- | testdata/scad/features/module-recursion.scad | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testdata/scad/features/module-recursion.scad b/testdata/scad/features/module-recursion.scad new file mode 100644 index 0000000..f67a1d0 --- /dev/null +++ b/testdata/scad/features/module-recursion.scad @@ -0,0 +1,15 @@ +module tree(currentScale, levels) +{ + h = currentScale; + w = currentScale/5; + childScale = currentScale * 0.7; + + if (levels > 0) { + cylinder(r=w, h=h); + translate([0,0,h]) for (i = [1:2]) { + rotate([40, 0, i * 180]) tree(childScale, levels-1); + } + } +} + +tree(1, 4); |