1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-31 10:11:53 +02:00

refactor: extact dir cond

This commit is contained in:
Justin Lin
2022-04-18 22:37:26 +08:00
parent 2ffef05abb
commit 639737a207

View File

@@ -13,14 +13,12 @@ use <ptf/ptf_rotate.scad>;
function sphere_spiral(radius, za_step, z_circles = 1, begin_angle = 0, end_angle = 0, vt_dir = "SPI_DOWN", rt_dir = "CT_CLK") =
let(
a_end = 90 * z_circles - end_angle,
p = [radius, 0, 0]
p = [radius, 0, 0],
ya_base = vt_dir == "SPI_DOWN" ? -90 : 90,
za_sign = rt_dir == "CT_CLK" ? 1 : -1
)
[
for(a = begin_angle; a <= a_end; a = a + za_step)
let(
ya = vt_dir == "SPI_DOWN" ? (-90 + 2 * a / z_circles) : (90 + 2 * a / z_circles),
za = (rt_dir == "CT_CLK" ? 1 : -1) * a,
ra = [0, ya, za]
)
[ptf_rotate(p, ra), ra]
let(ra = [0, ya_base + 2 * a / z_circles, za_sign * a])
[ptf_rotate(p, ra), ra]
];