mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 01:04:07 +02:00
fixed parameters vt_dir, rt_dir
This commit is contained in:
@@ -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
|
||||
|
||||
|
@@ -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]
|
||||
|
Reference in New Issue
Block a user