sphere_spiral.scad
1 /** 2 * sphere_spiral.scad 3 * 4 * @copyright Justin Lin, 2017 5 * @license https://opensource.org/licenses/lgpl-3.0.html 6 * 7 * @see https://openhome.cc/eGossip/OpenSCAD/lib3x-sphere_spiral.html 8 * 9 **/ 10 11 use <ptf/ptf_rotate.scad> 12 13 function sphere_spiral(radius, za_step, z_circles = 1, begin_angle = 0, end_angle = 0, vt_dir = "SPI_DOWN", rt_dir = "CT_CLK") = 14 let( 15 a_end = 90 * z_circles - end_angle, 16 p = [radius, 0, 0], 17 ya_base = vt_dir == "SPI_DOWN" ? -90 : 90, 18 za_sign = rt_dir == "CT_CLK" ? 1 : -1 19 ) 20 [ 21 for(a = begin_angle; a <= a_end; a = a + za_step) 22 let(ra = [0, ya_base + 2 * a / z_circles, za_sign * a]) 23 [ptf_rotate(p, ra), ra] 24 ];