shape_path_extend


將一個初始 2D 筆觸沿著指定路徑畫出一個 2D 圖案,適用於連續函式,傳回的座標點可以與我的 xxx_extrude 或內建的 polygon 模組結合。

使用這個函式時,使用座標點定義第一個筆觸。

相依於:rotate_p

參數

  • stroke_pts : 代表筆觸的座標點,詳見底下範例。
  • path_pts : 代表路徑的座標點。
  • scale : 在路徑上延伸時的縮放。
  • closed : 如果路徑上第一個座標點與最後一個座標點相同,將 closed 設為 true,可以形成封閉路徑。

範例

include <rotate_p.scad>;
include <shape_path_extend.scad>;
include <circle_path.scad>;
include <archimedean_spiral.scad>;

$fn = 96;

stroke1 = [[-5, 2.5], [-2.5, 0], [0, 2.5], [2.5, 0], [5, 2.5]];
path_pts1 = circle_path(50, 60);
polygon(
    shape_path_extend(stroke1, path_pts1)
);


stroke2 = [[-4, 0], [0, 4], [4, 0]];
pts_angles = archimedean_spiral(
    arm_distance = 17,
    init_angle = 180,
    point_distance = 5,
    num_of_points = 85 
); 

translate([120, 0, 0]) 
    polygon(
        shape_path_extend(
            stroke2, 
            [for(pa = pts_angles) pa[0]]
        )
    );

shape_path_extend

include <rotate_p.scad>;
include <bezier_curve.scad>;
include <shape_path_extend.scad>;

include <polysections.scad>;
include <path_extrude.scad>;


t_step = 0.1;
width = 2;

p0 = [0, 0];
p1 = [40, 60];
p2 = [50, 90];
p3 = [0, 200];

path = bezier_curve(t_step, 
    [p0, p1, p2, p3]
);

stroke = [[-5, 2.5], [-2.5, 0], [0, 2.5], [2.5, 0], [5, 2.5]];

path_extrude(
    shape_path_extend(stroke, path, scale = 5), 
    path,
    scale = 0.1
);

shape_path_extend