mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-12 01:34:12 +02:00
draw OBTUSE & ACUTE
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
use <ptf/ptf_rotate.scad>;
|
use <ptf/ptf_rotate.scad>;
|
||||||
use <triangle/tri_incenter.scad>;
|
use <polyline_join.scad>;
|
||||||
use <experimental/tile_penrose3.scad>;
|
use <experimental/tile_penrose3.scad>;
|
||||||
|
|
||||||
n = 8;
|
n = 9;
|
||||||
spacing = 0.1;
|
spacing = 0.1;
|
||||||
invert = "NO";
|
invert = "NO";
|
||||||
|
|
||||||
@@ -110,23 +110,27 @@ levels = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
module penrose3_crystallization(n, levels, spacing, invert) {
|
module penrose_crystallization(n, levels, spacing, invert) {
|
||||||
size = len(levels);
|
size = len(levels);
|
||||||
|
|
||||||
s = size * 1.4;
|
s = size * 1.4;
|
||||||
tris = tile_penrose3(n, [["OBTUSE", [ptf_rotate([1, 0], 108), [0, 0], [1, 0]]]]);
|
tris = tile_penrose3(n, [["OBTUSE", [ptf_rotate([1, 0], 108), [0, 0], [1, 0]]]]);
|
||||||
for(t = tris) {
|
for(t = tris) {
|
||||||
t_poly = t[1] * s;
|
sample_p = s * (t[1][0] + t[1][2]) / 2;
|
||||||
p = tri_incenter(t_poly);
|
level = levels[size - sample_p.y][sample_p.x];
|
||||||
level = levels[size - p.y][p.x];
|
|
||||||
if(!is_undef(level)) {
|
if(!is_undef(level)) {
|
||||||
h = level / 255;
|
h = level / 255;
|
||||||
|
t_poly = t[1] * s;
|
||||||
color([h, h, h])
|
color([h, h, h])
|
||||||
linear_extrude((invert == "YES" ? 10 - h * 10 : h * 10) + 2)
|
linear_extrude((invert == "YES" ? 10 - h * 10 : h * 10) + 2)
|
||||||
offset(-spacing)
|
difference() {
|
||||||
polygon(t_poly);
|
polygon(t_poly);
|
||||||
|
|
||||||
|
polyline_join(t_poly)
|
||||||
|
circle(spacing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
penrose3_crystallization(n, levels, spacing, invert);
|
penrose_crystallization(n, levels, spacing, invert);
|
Reference in New Issue
Block a user