sphere_spiral


取得繞球螺線的路徑上之座標點。傳回值的結構是 [[x, y, z], [ax, ay, az]][x, y, z] 實際上是以 [ax, ay, az] 轉動座標點 [radius, 0, 0] 而來。這個模組相依於 rotate_p 函式,記得含括 rotate_p.scad。

參數

  • radius : 球半徑。
  • za_step : 螺線會繞著 z 軸轉。轉動每增加 za_step 角度,就會計算出一個座標點。
  • z_circles : 螺線會繞著 z 軸轉。這個參數決定了從北極點至南極點總共會轉多少圈。預設是 1。
  • begin_angle : 預設值為 0,從北極點開始計算。詳見底下範例。
  • end_angle : 預設值是 0,從南極點開始計算。詳見底下範例。
  • vt_dir : "SPI_DOWN" 向下盤旋,"SPI_UP" 向上盤旋,預設為 "SPI_DOWN"
  • rt_dir : "CT_CLK" 逆時針,"CLK" 順時針。預設值為 "CT_CLK"

範例

include <rotate_p.scad>;
include <hull_polyline3d.scad>;
include <sphere_spiral.scad>;

points_angles = sphere_spiral(
    radius = 40, 
    za_step = 10, 
    z_circles = 20, 
    begin_angle = 90, 
    end_angle = 90
);

hull_polyline3d([for(pa = points_angles) pa[0]], 1);

%sphere(40);

sphere_spiral

sphere_spiral

sphere_spiral

include <rotate_p.scad>;
include <sphere_spiral.scad>;

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])
        rotate([90, 0, 90]) linear_extrude(1) 
            text("A", valign = "center", halign = "center");
}

%sphere(40);

sphere_spiral

include <rotate_p.scad>;
include <hull_polyline3d.scad>;
include <sphere_spiral.scad>;

points_angles = sphere_spiral(
    radius = 40, 
    za_step = 5
);

for(a = [0:30:360]) {
    rotate(a) 
        hull_polyline3d([for(pa = points_angles) pa[0]], 2);
}

sphere_spiral