1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-18 04:21:16 +02:00

update type

This commit is contained in:
Justin Lin
2021-08-11 17:38:42 +08:00
parent 505e384343
commit 428af98b5d

View File

@@ -10,7 +10,7 @@ function _subdivide(triangles) =
b = tri[2],
c = tri[3]
)
each (type ? _sub_obtuse(a, b, c) : _sub_acute(a, b, c))
each (type == "obtuse" ? _sub_obtuse(a, b, c) : _sub_acute(a, b, c))
];
function _sub_acute(a, b, c) =
@@ -18,7 +18,7 @@ function _sub_acute(a, b, c) =
PHI = 1.618033988749895,
p = a + (b - a) / PHI
)
[[false, c, p, b], [true, p, c, a]];
[["acute", c, p, b], ["obtuse", p, c, a]];
function _sub_obtuse(a, b, c) =
let(
@@ -26,7 +26,7 @@ function _sub_obtuse(a, b, c) =
q = b + (a - b) / PHI,
r = b + (c - b) / PHI
)
[[true, r, c, a], [true, q, r, b], [false, r, q, a]];
[["obtuse", r, c, a], ["obtuse", q, r, b], ["acute", r, q, a]];
function _penrose3(triangles, n, i = 0) =
i == n ? triangles :
@@ -40,35 +40,35 @@ function tile_penrose3(n) =
_penrose3([
for(i = [0:$fn - 1])
let(t = [for(p = shape_tri0) ptf_rotate(p, i * acute)])
i % 2 == 0 ? [false, t[0], t[1], t[2]] : [false, t[0], t[2], t[1]]
i % 2 == 0 ? ["acute", t[0], t[1], t[2]] : ["acute", t[0], t[2], t[1]]
], n);
module draw(tris) {
for(t = tris) {
color(t[0] ? "white" : "black")
color(t[0] == "obtuse" ? "white" : "black")
linear_extrude(.5)
polygon([t[2], t[1], t[3]]);
polygon([t[2], t[1], t[3]] * radius);
linear_extrude(1)
hull_polyline2d([t[2], t[1], t[3]], .1);
hull_polyline2d([t[2], t[1], t[3]] * radius, .1);
}
}
radius = 10;
$fn = 12;
draw(tile_penrose3(0) * radius);
draw(tile_penrose3(0));
translate([30, 0])
draw(tile_penrose3(1) * radius);
draw(tile_penrose3(1));
translate([60, 0])
draw(tile_penrose3(2) * radius);
draw(tile_penrose3(2));
translate([0, -30])
draw(tile_penrose3(3) * radius);
draw(tile_penrose3(3));
translate([30, -30])
draw(tile_penrose3(4) * radius);
draw(tile_penrose3(4));
translate([60, -30])
draw(tile_penrose3(5) * radius);
draw(tile_penrose3(5));