mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-19 13:01:37 +02:00
add fibonacci_sphere
This commit is contained in:
16
src/experimental/fibonacci_sphere.scad
Normal file
16
src/experimental/fibonacci_sphere.scad
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
function fibonacci_sphere(samples) =
|
||||||
|
let(
|
||||||
|
toDegrees = 180 / PI,
|
||||||
|
phi = PI * (3 - sqrt(5))
|
||||||
|
)
|
||||||
|
[
|
||||||
|
for(i = [0:samples - 1])
|
||||||
|
let(
|
||||||
|
y = 1 - (i / (samples - 1)) * 2,
|
||||||
|
radius = sqrt(1 - y * y),
|
||||||
|
theta = phi * i,
|
||||||
|
x = cos(theta * toDegrees) * radius,
|
||||||
|
z = sin(theta * toDegrees) * radius
|
||||||
|
)
|
||||||
|
[x, y, z]
|
||||||
|
];
|
Reference in New Issue
Block a user