1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-21 14:04:53 +02:00
This commit is contained in:
Justin Lin
2020-10-25 14:43:33 +08:00
parent a307fcd565
commit f2052b09d3

View File

@@ -1,12 +1,12 @@
function fibonacci_sphere(samples) = function fibonacci_sphere(n) =
let( let(
toDegrees = 180 / PI, toDegrees = 180 / PI,
phi = PI * (3 - sqrt(5)) phi = PI * (3 - sqrt(5))
) )
[ [
for(i = [0:samples - 1]) for(i = [0:n - 1])
let( let(
y = 1 - (i / (samples - 1)) * 2, y = 1 - (i / (n - 1)) * 2,
radius = sqrt(1 - y * y), radius = sqrt(1 - y * y),
theta = phi * i, theta = phi * i,
x = cos(theta * toDegrees) * radius, x = cos(theta * toDegrees) * radius,