1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-29 03:47:45 +01:00

added parameters vt_dir, rt_dir

This commit is contained in:
Justin Lin 2017-03-30 11:52:33 +08:00
parent 25a078a07a
commit bd370b2c2b
2 changed files with 8 additions and 2 deletions

View File

@ -9,6 +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"`.
## Examples

View File

@ -13,9 +13,13 @@
*
**/
function sphere_spiral(radius, za_step, z_circles = 1, begin_angle = 0, end_angle = 0) =
function sphere_spiral(radius, za_step, z_circles = 1, begin_angle = 0, end_angle = 0, vt_dir = "CT_CLK", rt_dir = "SPI_DOWN") =
[
for(a = [begin_angle:za_step:90 * z_circles - end_angle])
let(ra = [0, -90 + 2 * a / z_circles, a])
let(
ya = rt_dir == "SPI_DOWN" ? (-90 + 2 * a / z_circles) : (90 + 2 * a / z_circles),
za = (vt_dir == "CT_CLK" ? 1 : -1) * a,
ra = [0, ya, za]
)
[rotate_p([radius, 0, 0], ra), ra]
];