cross_sections


給一個 2D 圖形,路徑上的一組座標與角度,這個函式可以計算出路徑上的切面。結合 polysections 模組,就可以建立特定的路徑拉伸。

相依於 rotate_p 函式。

參數

  • shape_pts: 代表 2D 圖案的座標,詳見底下範例。
  • path_pts : 代表路徑的座標。
  • angles : 角度清單,每個角度會用來旋轉一開始給定的 2D 圖案。
  • twist: 在推移時的扭轉角度。
  • scale : 在推移時的縮放大小。可以是單一值或者是 [x, y] 形式.

範例

include <rotate_p.scad>;
include <polysections.scad>;
include <cross_sections.scad>;
include <archimedean_spiral.scad>;

shape_pts = [
    [-2, -10],
    [-2, 10],
    [2, 10],
    [2, -10]
];

pts_angles = archimedean_spiral(
    arm_distance = 20,
    init_angle = 180,
    point_distance = 5,
    num_of_points = 100 
); 

pts = [for(pt_angle = pts_angles) pt_angle[0]];
angles = [
    for(i = [0:len(pts_angles) - 1]) [90, 0, pts_angles[i][1]]
];

polysections(
    cross_sections(shape_pts, pts, angles, twist = 180, scale = 0.1)
);

cross_sections