mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-20 13:31:30 +02:00
update type
This commit is contained in:
@@ -10,7 +10,7 @@ function _subdivide(triangles) =
|
|||||||
b = tri[2],
|
b = tri[2],
|
||||||
c = tri[3]
|
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) =
|
function _sub_acute(a, b, c) =
|
||||||
@@ -18,7 +18,7 @@ function _sub_acute(a, b, c) =
|
|||||||
PHI = 1.618033988749895,
|
PHI = 1.618033988749895,
|
||||||
p = a + (b - a) / PHI
|
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) =
|
function _sub_obtuse(a, b, c) =
|
||||||
let(
|
let(
|
||||||
@@ -26,7 +26,7 @@ function _sub_obtuse(a, b, c) =
|
|||||||
q = b + (a - b) / PHI,
|
q = b + (a - b) / PHI,
|
||||||
r = b + (c - 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) =
|
function _penrose3(triangles, n, i = 0) =
|
||||||
i == n ? triangles :
|
i == n ? triangles :
|
||||||
@@ -40,35 +40,35 @@ function tile_penrose3(n) =
|
|||||||
_penrose3([
|
_penrose3([
|
||||||
for(i = [0:$fn - 1])
|
for(i = [0:$fn - 1])
|
||||||
let(t = [for(p = shape_tri0) ptf_rotate(p, i * acute)])
|
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);
|
], n);
|
||||||
|
|
||||||
module draw(tris) {
|
module draw(tris) {
|
||||||
for(t = tris) {
|
for(t = tris) {
|
||||||
color(t[0] ? "white" : "black")
|
color(t[0] == "obtuse" ? "white" : "black")
|
||||||
linear_extrude(.5)
|
linear_extrude(.5)
|
||||||
polygon([t[2], t[1], t[3]]);
|
polygon([t[2], t[1], t[3]] * radius);
|
||||||
linear_extrude(1)
|
linear_extrude(1)
|
||||||
hull_polyline2d([t[2], t[1], t[3]], .1);
|
hull_polyline2d([t[2], t[1], t[3]] * radius, .1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
radius = 10;
|
radius = 10;
|
||||||
$fn = 12;
|
$fn = 12;
|
||||||
|
|
||||||
draw(tile_penrose3(0) * radius);
|
draw(tile_penrose3(0));
|
||||||
|
|
||||||
translate([30, 0])
|
translate([30, 0])
|
||||||
draw(tile_penrose3(1) * radius);
|
draw(tile_penrose3(1));
|
||||||
|
|
||||||
translate([60, 0])
|
translate([60, 0])
|
||||||
draw(tile_penrose3(2) * radius);
|
draw(tile_penrose3(2));
|
||||||
|
|
||||||
translate([0, -30])
|
translate([0, -30])
|
||||||
draw(tile_penrose3(3) * radius);
|
draw(tile_penrose3(3));
|
||||||
|
|
||||||
translate([30, -30])
|
translate([30, -30])
|
||||||
draw(tile_penrose3(4) * radius);
|
draw(tile_penrose3(4));
|
||||||
|
|
||||||
translate([60, -30])
|
translate([60, -30])
|
||||||
draw(tile_penrose3(5) * radius);
|
draw(tile_penrose3(5));
|
Reference in New Issue
Block a user