2022-06-06 13:11:46 +08:00
|
|
|
use <golden_spiral.scad>
|
|
|
|
use <ptf/ptf_rotate.scad>
|
|
|
|
use <hollow_out.scad>
|
|
|
|
use <voronoi/vrn2_cells_from.scad>
|
2020-03-14 09:52:33 +08:00
|
|
|
|
|
|
|
spirals = 2; // [2:]
|
|
|
|
line_thickness = .5;
|
|
|
|
cell_thickness = 2;
|
|
|
|
cell_top_scale = 0.8;
|
|
|
|
style = "BLOCK"; // [BLOCK, LINE]
|
|
|
|
|
|
|
|
from = 5;
|
|
|
|
to = 8;
|
|
|
|
point_distance = 10;
|
|
|
|
|
|
|
|
voronoi_fibonacci();
|
|
|
|
|
|
|
|
module voronoi_fibonacci() {
|
|
|
|
points_angles = golden_spiral(
|
|
|
|
from = from,
|
|
|
|
to = to,
|
|
|
|
point_distance = point_distance
|
|
|
|
);
|
2020-03-14 09:56:23 +08:00
|
|
|
spiral = [for(pa = points_angles) pa[0]];
|
2020-03-14 09:52:33 +08:00
|
|
|
|
|
|
|
a_step = 360 / spirals;
|
|
|
|
|
|
|
|
pts = [
|
|
|
|
for(a = [0:a_step:360 - a_step])
|
2020-03-24 17:21:17 +08:00
|
|
|
each [for(p = spiral) ptf_rotate(p, a)]
|
2020-03-14 09:52:33 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
half_line_thicness = line_thickness / 2;
|
2020-03-14 09:56:23 +08:00
|
|
|
lst_r = norm(spiral[len(spiral) - 1]) + half_line_thicness;
|
|
|
|
|
2020-05-23 16:57:12 +08:00
|
|
|
cells = vrn2_cells_from(pts);
|
2020-03-14 09:52:33 +08:00
|
|
|
for(i = [0:len(pts) - 1]) {
|
|
|
|
cell = cells[i];
|
|
|
|
|
|
|
|
if(style == "BLOCK") {
|
2020-03-14 09:56:23 +08:00
|
|
|
pt = pts[i];
|
2020-03-14 09:52:33 +08:00
|
|
|
color(rands(0, 1, 3))
|
|
|
|
translate(pt)
|
|
|
|
linear_extrude(cell_thickness, scale = cell_top_scale)
|
|
|
|
translate(-pt)
|
|
|
|
intersection() {
|
|
|
|
polygon(cell);
|
|
|
|
circle(lst_r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
linear_extrude(line_thickness)
|
2020-03-14 13:36:57 +08:00
|
|
|
intersection() {
|
|
|
|
hollow_out(half_line_thicness) polygon(cell);
|
|
|
|
circle(lst_r);
|
|
|
|
}
|
2020-03-14 09:52:33 +08:00
|
|
|
}
|
|
|
|
}
|
2020-03-14 13:36:57 +08:00
|
|
|
|
2020-03-14 13:37:57 +08:00
|
|
|
linear_extrude(line_thickness) {
|
|
|
|
if(style == "BLOCK") {
|
2020-03-14 13:36:57 +08:00
|
|
|
circle(lst_r);
|
2020-03-14 13:37:57 +08:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
hollow_out(line_thickness)
|
|
|
|
circle(lst_r);
|
|
|
|
}
|
2020-03-14 13:36:57 +08:00
|
|
|
}
|
2020-03-14 09:52:33 +08:00
|
|
|
}
|