fibonacci_lattice2.scad
1 function fibonacci_lattice2(n, radius = 1, rt_dir = "CT_CLK") = 2 let( 3 g = 2/ (1 + sqrt(5)), 4 dir = rt_dir == "CT_CLK" ? -1 : 1 5 ) 6 [ 7 for(i = [0:n - 1]) 8 let( 9 k = i + 0.5, 10 r = sqrt(k / n), 11 theta = dir * k * g * 360 12 ) 13 [radius * r * cos(theta), radius * r * sin(theta)] 14 ]; 15 16 num_pts = 300; 17 pts = fibonacci_lattice2(num_pts); 18 19 for(p = pts) { 20 translate(p) 21 circle(.01, $fn = 24); 22 } 23