mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 22:28:16 +01:00
refactor
This commit is contained in:
parent
987bc3be5b
commit
57914a8245
@ -8,20 +8,20 @@
|
||||
*
|
||||
**/
|
||||
|
||||
use <util/degrees.scad>;
|
||||
|
||||
function fibonacci_lattice(n, radius = 1, dir = "CT_CLK") =
|
||||
let(
|
||||
toDegrees = 180 / PI,
|
||||
phi = PI * (3 - sqrt(5)),
|
||||
clk = dir == "CT_CLK" ? 1 : -1
|
||||
)
|
||||
[
|
||||
for(i = [0:n - 1])
|
||||
let(
|
||||
z = 1 - (2* i + 1) / n,
|
||||
r = sqrt(1 - z * z),
|
||||
z = 1 - (2 * i + 1) / n,
|
||||
r = sqrt(1 - z ^ 2),
|
||||
theta = phi * i * clk,
|
||||
x = cos(theta * toDegrees) * r,
|
||||
y = sin(theta * toDegrees) * r
|
||||
deg = degrees(theta)
|
||||
)
|
||||
[x, y, z] * radius
|
||||
[cos(deg) * r, sin(deg) * r, z] * radius
|
||||
];
|
Loading…
x
Reference in New Issue
Block a user