1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00
This commit is contained in:
Justin Lin
2020-12-14 17:26:23 +08:00
parent 14529f3393
commit b6eb4bf606
5 changed files with 46 additions and 3 deletions

View File

@@ -236,7 +236,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
### Path
- [curve](https://openhome.cc/eGossip/OpenSCAD/lib2x-curve.html)
- bauer_spiral
- [bauer_spiral](https://openhome.cc/eGossip/OpenSCAD/lib2x-bauer_spiral.html)
- fibonacci_lattice
### Voxel

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

View File

@@ -0,0 +1,33 @@
# bauer_spiral
Creates visually even spacing of n points on the surface of the sphere. Successive points will all be approximately the same distance apart.
(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.)
## 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
use <bauer_spiral.scad>;
use <hull_polyline3d.scad>;
n = 200;
radius = 20;
pts = bauer_spiral(n, radius);
for(p = pts) {
translate(p)
sphere(1, $fn = 24);
}
hull_polyline3d(pts, 1);
![bauer_spiral](images/lib2x-bauer_spiral-1.JPG)
You can use it to create [Text sphere](https://cults3d.com/en/3d-model/art/bauer-text-sphere).
![bauer_spiral](images/lib2x-bauer_spiral-2.JPG)

View File

@@ -1,9 +1,19 @@
function bauer_spiral(n, radius = 1, dir = "CT_CLK") =
/**
* bauer_spiral.scad
*
* @copyright Justin Lin, 2019
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-bauer_spiral.html
*
**/
function bauer_spiral(n, radius = 1, rt_dir = "CT_CLK") =
let(
L = sqrt(n * PI),
toRadians = PI / 180,
toDegrees = 180 / PI,
clk = dir == "CT_CLK" ? 1 : -1
clk = rt_dir == "CT_CLK" ? 1 : -1
)
[
for(k = 1; k <= n; k = k + 1)