golden_spiral


取得黃金螺線(基於費式數列)路徑上各個點。各點之間的距離近乎相等。傳回值為 [[x, y], angle] 形式。

這個模組相依於 circle_pathrotate_p,記得含括 circle_path.scad 與 rotate_p.scad。

參數

  • from : 從第幾個費式數開始?
  • to : 到幾個費式數結束?
  • point_distance : 路徑上兩點間的距離。
  • rt_dir : "CT_CLK" 是逆時針轉,"CLK" 是順時針轉。預設為 "CT_CLK"

範例

include <circle_path.scad>;
include <rotate_p.scad>;
include <golden_spiral.scad>;

pts_angles = golden_spiral(
    from = 3, 
    to = 10, 
    point_distance = 1
);

for(pt_angle = pts_angles) {
    translate(pt_angle[0]) 
        sphere(0.5);
}

golden_spiral

include <circle_path.scad>;
include <rotate_p.scad>;
include <golden_spiral.scad>;

pts_angles = golden_spiral(
    from = 5, 
    to = 11, 
    point_distance = 4
);

for(pt_angle = pts_angles) {
    translate(pt_angle[0]) 
        rotate([90, 0, pt_angle[1]])
            linear_extrude(1, center = true) 
                text("A", valign = "center", halign = "center");
}

golden_spiral