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

25 lines
747 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
*
2021-02-24 21:09:54 +08:00
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-sphere_spiral.html
2017-03-29 17:51:57 +08:00
*
**/
2020-03-24 17:31:32 +08:00
use <ptf/ptf_rotate.scad>;
2020-01-27 16:23:39 +08:00
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") =
2019-06-14 13:38:32 +08:00
let(
a_end = 90 * z_circles - end_angle
)
2017-03-29 17:51:57 +08:00
[
2019-06-14 13:38:32 +08:00
for(a = begin_angle; a <= a_end; a = a + za_step)
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]
)
2020-03-24 17:31:32 +08:00
[ptf_rotate([radius, 0, 0], ra), ra]
2017-03-29 17:51:57 +08:00
];