mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-14 02:34:12 +02:00
halftone
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
use <experimental/fibonacci_lattice2.scad>
|
use <experimental/fibonacci_lattice2.scad>
|
||||||
|
|
||||||
num_pts = 5000;
|
num_pts = 5000;
|
||||||
dot_r = .6;
|
thickness = 3;
|
||||||
dot_fn = 4;
|
dot_r_scale = 0.00125;
|
||||||
|
dot_fn = 12;
|
||||||
levels = [
|
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],
|
||||||
[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);
|
pts = fibonacci_lattice2(num_pts);
|
||||||
|
|
||||||
for(p = pts) {
|
color("white")
|
||||||
sample_p = r * p + center;
|
translate([0, 0, thickness / 2])
|
||||||
h = levels[rows - floor(sample_p.y) - 1][floor(sample_p.x)];
|
linear_extrude(thickness / 2)
|
||||||
a = atan2(p.y, p.x);
|
difference() {
|
||||||
|
circle(r, $fn = 48);
|
||||||
color([h, h, h] / 255)
|
{
|
||||||
translate(r * p)
|
for(p = pts) {
|
||||||
linear_extrude(h / 100 + 1)
|
sample_p = r * p + center;
|
||||||
rotate(a)
|
h = levels[rows - floor(sample_p.y) - 1][floor(sample_p.x)];
|
||||||
circle(dot_r, $fn = dot_fn);
|
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);
|
Reference in New Issue
Block a user