1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-06 14:56:47 +02:00
This commit is contained in:
Justin Lin
2022-07-19 11:50:55 +08:00
parent e6e52f7ab8
commit a51a8f2bd4

View File

@@ -1,18 +1,18 @@
function fibonacci_lattice2(n, radius = 1, rt_dir = "CT_CLK") = function fibonacci_lattice2(n, radius = 1, rt_dir = "CT_CLK") =
let( let(
g = (1 + sqrt(5)) / 2, g = 2/ (1 + sqrt(5)),
dir = rt_dir == "CT_CLK" ? -1 : 1 dir = rt_dir == "CT_CLK" ? -1 : 1
) )
[ [
for(i = [0:n - 1]) for(i = [0:n - 1])
let( let(
r = sqrt(i / n), k = i + 0.5,
theta = dir * i * g * 360 r = sqrt(k / n),
theta = dir * k * g * 360
) )
[radius * r * cos(theta), radius * r * sin(theta)] [radius * r * cos(theta), radius * r * sin(theta)]
]; ];
num_pts = 300; num_pts = 300;
pts = fibonacci_lattice2(num_pts); pts = fibonacci_lattice2(num_pts);