2020-12-15 10:08:10 +08:00
# fibonacci_lattice
2022-07-19 11:18:29 +08:00
Creates visually even spacing of n points on the surface of the sphere. Nearest-neighbor points will all be approximately the same distance apart.
2020-12-15 10:08:10 +08:00
(It's called "visually even spacing" because only the vertices of the 5 [Platonic solids ](https://en.wikipedia.org/wiki/Platonic_solid ) can be said to be truly evenly spaced around the surface of a sphere.)
2020-12-20 10:25:48 +08:00
**Since:** 2.5
2020-12-15 10:08:10 +08:00
## Parameters
- `n` : The number of points.
- `radius` : The sphere radius. Default to 1.
- `rt_dir` : `"CT_CLK"` for counterclockwise. `"CLK"` for clockwise. The default value is `"CT_CLK"` .
## Examples
2022-06-06 13:11:46 +08:00
use < fibonacci_lattice.scad >
2020-12-15 10:08:10 +08:00
n = 200;
radius = 20;
pts = fibonacci_lattice(n, radius);
for(p = pts) {
translate(p)
sphere(1);
}
sphere(radius);
2021-02-24 21:09:54 +08:00
![fibonacci_lattice ](images/lib3x-fibonacci_lattice-1.JPG )
2022-07-19 11:34:07 +08:00
use < fibonacci_lattice.scad >
use < polyline_join.scad >
2020-12-15 10:08:10 +08:00
n = 200;
radius = 20;
pts = fibonacci_lattice(n, radius);
for(p = pts) {
translate(p)
sphere(1);
}
2022-07-19 10:18:26 +08:00
sphere(radius * 0.9);
2022-07-19 11:18:29 +08:00
// You can pick spirals from points.
2022-07-19 10:18:26 +08:00
spirals = [for(j = [0:20])
[for(i = j; i < len ( pts ) ; i = i + 21 ) pts [ i ] ]
2020-12-15 10:08:10 +08:00
];
2022-07-19 10:18:26 +08:00
2020-12-15 10:08:10 +08:00
for(spiral = spirals) {
2021-11-18 08:08:50 +08:00
polyline_join(spiral)
2022-07-19 10:18:26 +08:00
sphere(.25);
2020-12-15 10:08:10 +08:00
}
2021-02-24 21:09:54 +08:00
![fibonacci_lattice ](images/lib3x-fibonacci_lattice-2.JPG )