1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-23 17:15:05 +01:00
dotSCAD/src/sphere_spiral.scad

20 lines
665 B
OpenSCAD
Raw Normal View History

2017-03-29 17:51:57 +08:00
/**
* sphere_spiral.scad
*
* @copyright Justin Lin, 2017
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib-sphere_spiral.html
*
**/
2017-03-30 12:17:12 +08:00
function sphere_spiral(radius, za_step, z_circles = 1, begin_angle = 0, end_angle = 0, vt_dir = "SPI_DOWN", rt_dir = "CT_CLK") =
2017-03-29 17:51:57 +08:00
[
for(a = [begin_angle:za_step:90 * z_circles - end_angle])
2017-03-30 11:52:33 +08:00
let(
2017-03-30 12:17:12 +08:00
ya = vt_dir == "SPI_DOWN" ? (-90 + 2 * a / z_circles) : (90 + 2 * a / z_circles),
za = (rt_dir == "CT_CLK" ? 1 : -1) * a,
2017-03-30 11:52:33 +08:00
ra = [0, ya, za]
)
2017-03-29 17:51:57 +08:00
[rotate_p([radius, 0, 0], ra), ra]
];