1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/examples/turtle/fern_leaf_stencil.scad

67 lines
1.6 KiB
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <polyline_join.scad>
use <hollow_out.scad>
use <turtle/t2d.scad>
2019-09-29 16:39:23 +08:00
radius = 40;
height = 3;
thickness = 1;
width = 1;
min_leng = 0.1;
k1 = 0.9;
k2 = 0.3;
module fern_leaf(t, leng, min_leng, k1, k2, width) {
t1 = t2d(t, "forward", leng = leng);
2021-10-08 09:36:01 +08:00
polyline_join([t2d(t, "point"), t2d(t1, "point")])
circle(width / 2);
2019-09-29 16:41:47 +08:00
2019-09-29 16:39:23 +08:00
if(leng > min_leng) {
fern_leaf(
t2d(t1, "turn", angle = 70),
k2 * leng, min_leng, k1, k2, width
);
t2 = t2d(t1, "forward", leng = k1 * leng);
2021-10-08 09:36:01 +08:00
polyline_join([t2d(t1, "point"), t2d(t2, "point")])
circle(width / 2);
2019-09-29 16:39:23 +08:00
t3 = t2d(t2, "turn", angle = -69.0);
fern_leaf(
t3,
k1 * k2 * leng, min_leng, k1, k2, width
);
fern_leaf(
t2d(t3, "turn", angle = 68.0),
k1 * k1 * leng, min_leng, k1, k2, width
);
}
}
module fern_leaf_stencil(radius, height, thickness, width, min_leng, k1, k2) {
$fn = 48;
linear_extrude(thickness)
difference() {
union() {
translate([radius, 0])
scale([1, 0.5, 1])
hollow_out(radius / 3)
circle(radius / 1.5);
circle(radius);
}
translate([-radius, 0])
fern_leaf(
t2d(point = [0, 0], angle = 0),
radius / 5, min_leng, k1, k2, width
);
}
linear_extrude(height)
hollow_out(thickness)
circle(radius + thickness);
}
fern_leaf_stencil(radius, height, thickness, width, min_leng, k1, k2);