1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-19 04:51:26 +02:00

adjust poles

This commit is contained in:
Justin Lin
2020-10-25 14:52:51 +08:00
parent f2052b09d3
commit b742ff3454

View File

@@ -1,16 +1,17 @@
function fibonacci_sphere(n) = function fibonacci_sphere(n, dir = "CT_CLK") =
let( let(
toDegrees = 180 / PI, toDegrees = 180 / PI,
phi = PI * (3 - sqrt(5)) phi = PI * (3 - sqrt(5)),
clk = dir == "CT_CLK" ? 1 : -1
) )
[ [
for(i = [0:n - 1]) for(i = [0:n - 1])
let( let(
y = 1 - (i / (n - 1)) * 2, z = 1 - (2* i + 1) / n,
radius = sqrt(1 - y * y), r = sqrt(1 - z * z),
theta = phi * i, theta = phi * i * clk,
x = cos(theta * toDegrees) * radius, x = cos(theta * toDegrees) * r,
z = sin(theta * toDegrees) * radius y = sin(theta * toDegrees) * r
) )
[x, y, z] [x, y, z]
]; ];