1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/docs/lib3x-sphere_spiral.md

73 lines
2.1 KiB
Markdown
Raw Normal View History

2017-03-29 17:51:57 +08:00
# sphere_spiral
2019-06-17 08:33:00 +08:00
Creates all points and angles on the path of a spiral around a sphere. It returns a vector of `[[x, y, z], [ax, ay, az]]`. `[x, y, z]` is actually obtained from rotating `[radius, 0, 0]` by `[ax, ay, az]`.
2017-03-29 17:51:57 +08:00
## Parameters
- `radius` : The radius of the sphere.
- `za_step` : The spiral rotates around the z axis. When the rotated angle increases `za_step`, a point will be calculated.
- `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.
2017-03-30 12:17:12 +08:00
- `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"`.
2017-03-29 17:51:57 +08:00
## Examples
2022-06-06 13:11:46 +08:00
use <polyline_join.scad>
use <sphere_spiral.scad>
2017-03-29 17:51:57 +08:00
points_angles = sphere_spiral(
radius = 40,
za_step = 10,
z_circles = 20,
begin_angle = 90,
end_angle = 90
);
2021-12-04 10:57:29 +08:00
polyline_join([for(pa = points_angles) pa[0]])
sphere(.5);
2017-03-29 17:51:57 +08:00
%sphere(40);
2021-02-24 21:09:54 +08:00
![sphere_spiral](images/lib3x-sphere_spiral-1.JPG)
2017-03-29 17:51:57 +08:00
2021-02-24 21:09:54 +08:00
![sphere_spiral](images/lib3x-sphere_spiral-2.JPG)
2017-03-29 17:51:57 +08:00
2021-02-24 21:09:54 +08:00
![sphere_spiral](images/lib3x-sphere_spiral-3.JPG)
2017-03-29 17:51:57 +08:00
2022-06-06 13:11:46 +08:00
use <sphere_spiral.scad>
2017-03-29 17:51:57 +08:00
points_angles = sphere_spiral(
radius = 40,
za_step = 20,
z_circles = 40,
begin_angle = 900
);
for(pa = points_angles) {
translate(pa[0]) rotate(pa[1])
2022-04-06 17:44:11 +08:00
rotate([90, 0, 90]) linear_extrude(1)
text("A", valign = "center", halign = "center");
2017-03-29 17:51:57 +08:00
}
%sphere(40);
2021-02-24 21:09:54 +08:00
![sphere_spiral](images/lib3x-sphere_spiral-5.JPG)
2017-03-29 17:51:57 +08:00
2022-06-06 13:11:46 +08:00
use <polyline_join.scad>
use <sphere_spiral.scad>
2017-03-29 17:51:57 +08:00
points_angles = sphere_spiral(
radius = 40,
za_step = 5
);
for(a = [0:30:360]) {
rotate(a)
2021-12-04 10:57:29 +08:00
polyline_join([for(pa = points_angles) pa[0]])
sphere(1);
2017-03-29 17:51:57 +08:00
}
2021-02-24 21:09:54 +08:00
![sphere_spiral](images/lib3x-sphere_spiral-6.JPG)