1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-18 12:31:17 +02:00
This commit is contained in:
Justin Lin
2019-09-28 17:33:04 +08:00
parent 33276552e9
commit 7488f62df7

View File

@@ -9,25 +9,25 @@ sierpinski_pyramid(side_leng, min_leng, thickness, $fn = 4);
module sierpinski_pyramid(side_leng, min_leng, thickness) {
pyramid_frame(side_leng, thickness);
if(side_leng > min_leng){
half_len = side_leng / 2;
h = half_len * 0.707107;
half_leng = side_leng / 2;
h = half_leng * 0.707107;
pt = [side_leng / 4, side_leng / 4, 0];
for(i=[0:3]) {
rotate([0, 0, i * 90])
translate(pt)
sierpinski_pyramid(half_len, min_leng, thickness);
sierpinski_pyramid(half_leng, min_leng, thickness);
}
translate([0, 0, h])
sierpinski_pyramid(half_len, min_leng, thickness);
sierpinski_pyramid(half_leng, min_leng, thickness);
}
}
module pyramid_frame(side_leng, thickness) {
half_len = side_leng / 2;
h = half_len * 1.414214;
half_leng = side_leng / 2;
h = half_leng * 1.414214;
tri_pts = [[0, 0, h], [half_len, half_len, 0], [half_len, -half_len, 0], [0, 0, h]];
line_pts = [[half_len, half_len, 0], [-half_len, half_len, 0]];
tri_pts = [[0, 0, h], [half_leng, half_leng, 0], [half_leng, -half_leng, 0], [0, 0, h]];
line_pts = [[half_leng, half_leng, 0], [-half_leng, half_leng, 0]];
hull_polyline3d(tri_pts, thickness);
mirror([1, 0, 0])