1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00

add sierpinski_carpet

This commit is contained in:
Justin Lin
2020-04-15 10:01:35 +08:00
parent 4d9f09d48b
commit c9027dfa2f

View File

@@ -1,7 +1,7 @@
use <experimental/lsystem2.scad>;
use <line2d.scad>;
for(line = island_curve()) {
for(line = sierpinski_carpet()) {
line2d(
line[0],
line[1],
@@ -212,6 +212,16 @@ function sierpinski_square(n = 8, angle = 45, leng = 1, heading = 0, start = [0,
)
lsystem2(axiom, rules, n, angle, leng, heading, start);
function sierpinski_carpet(n = 4, angle = 90, leng = 1, heading = 0, start = [0, 0]) =
let(
axiom = "F",
rules = [
["F", "F+F-F-F-G+F+F+F-F"],
["G", "GGG"]
]
)
lsystem2(axiom, rules, n, angle, leng, heading, start, forward_chars = "G");
function terdragon(n = 5, angle = 120, leng = 1, heading = 0, start = [0, 0]) =
let(
axiom = "F",