1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00
This commit is contained in:
Justin Lin
2022-08-06 15:05:17 +08:00
parent bd64388362
commit 3a4e6b2a19

View File

@@ -1,8 +1,9 @@
use <experimental/fibonacci_lattice2.scad>
num_pts = 5000;
dot_r = .6;
dot_fn = 4;
thickness = 3;
dot_r_scale = 0.00125;
dot_fn = 12;
levels = [
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
@@ -113,15 +114,26 @@ r = min(rows, columns) / 2;
pts = fibonacci_lattice2(num_pts);
for(p = pts) {
sample_p = r * p + center;
h = levels[rows - floor(sample_p.y) - 1][floor(sample_p.x)];
a = atan2(p.y, p.x);
color([h, h, h] / 255)
translate(r * p)
linear_extrude(h / 100 + 1)
rotate(a)
circle(dot_r, $fn = dot_fn);
color("white")
translate([0, 0, thickness / 2])
linear_extrude(thickness / 2)
difference() {
circle(r, $fn = 48);
{
for(p = pts) {
sample_p = r * p + center;
h = levels[rows - floor(sample_p.y) - 1][floor(sample_p.x)];
a = atan2(p.y, p.x);
dot_r = (255 - h) * dot_r_scale;
if(dot_r > 0) {
translate(r * p)
rotate(a)
circle(dot_r + 0.4, $fn = dot_fn);
}
}
}
}
color("black")
linear_extrude(thickness / 2)
circle(r);