1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 10:14:41 +02:00
This commit is contained in:
Justin Lin
2022-04-18 22:32:41 +08:00
parent 96432c8525
commit 2ffef05abb
2 changed files with 7 additions and 10 deletions

View File

@@ -19,11 +19,9 @@ function bauer_spiral(n, radius = 1, rt_dir = "CT_CLK") =
[
for(k = 1; k <= n; k = k + 1)
let(
z = 1 - (2 * k - 1) / n,
z = 1 - (2 * k - 1) / n, // cos_phi
sin_phi = sqrt(1 - z ^ 2),
theta = clk * L * acos(z),
x = sin_phi * cos(theta),
y = sin_phi * sin(theta)
theta = clk * L * acos(z)
)
[x, y, z] * radius
[sin_phi * cos(theta), sin_phi * sin(theta), z] * radius
];

View File

@@ -18,10 +18,9 @@ function fibonacci_lattice(n, radius = 1, dir = "CT_CLK") =
[
for(i = [0:n - 1])
let(
z = 1 - (2 * i + 1) / n,
r = sqrt(1 - z ^ 2),
theta = phi * i * clk,
deg = degrees(theta)
z = 1 - (2 * i + 1) / n, // cos_phi
sin_phi = sqrt(1 - z ^ 2),
theta = clk * i * degrees(phi)
)
[cos(deg) * r, sin(deg) * r, z] * radius
[cos(theta) * sin_phi, sin(theta) * sin_phi, z] * radius
];