diff --git a/docs/lib-sphere_spiral.md b/docs/lib-sphere_spiral.md index 80ec42ee..9b776716 100644 --- a/docs/lib-sphere_spiral.md +++ b/docs/lib-sphere_spiral.md @@ -9,8 +9,8 @@ Creates all points and angles on the path of a spiral around a sphere. It return - `z_circles` : The spiral rotates around the z axis. This parameter determines how many circles it will rotate from the top to the end. It defaults to 1. - `begin_angle` : The default value is 0 which means begins from the north pole of the sphere. See examples below. - `end_angle` : The default value is 0 which means begins from the sourth pole of the sphere. See examples below. -- `vt_dir` : `"CT_CLK"` for counterclockwise. `"CLK"` for clockwise. The default value is `"CT_CLK"`. -- `rt_dir` : `"SPI_DOWN"` for spiraling down. `"SPI_UP"` for spiraling up. The default value is `"SPI_DOWN"`. +- `vt_dir` : `"SPI_DOWN"` for spiraling down. `"SPI_UP"` for spiraling up. The default value is `"SPI_DOWN"`. +- `rt_dir` : `"CT_CLK"` for counterclockwise. `"CLK"` for clockwise. The default value is `"CT_CLK"`. ## Examples diff --git a/src/sphere_spiral.scad b/src/sphere_spiral.scad index 0b82a172..375ba450 100644 --- a/src/sphere_spiral.scad +++ b/src/sphere_spiral.scad @@ -13,12 +13,12 @@ * **/ -function sphere_spiral(radius, za_step, z_circles = 1, begin_angle = 0, end_angle = 0, vt_dir = "CT_CLK", rt_dir = "SPI_DOWN") = +function sphere_spiral(radius, za_step, z_circles = 1, begin_angle = 0, end_angle = 0, vt_dir = "SPI_DOWN", rt_dir = "CT_CLK") = [ for(a = [begin_angle:za_step:90 * z_circles - end_angle]) let( - ya = rt_dir == "SPI_DOWN" ? (-90 + 2 * a / z_circles) : (90 + 2 * a / z_circles), - za = (vt_dir == "CT_CLK" ? 1 : -1) * a, + 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] ) [rotate_p([radius, 0, 0], ra), ra]