From bc17a2df194c814aa2346946a5a2a4ccf49fa0ce Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 1 Oct 2021 08:27:07 +0800 Subject: [PATCH] add polyline_hull --- src/polyline_hull.scad | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/polyline_hull.scad diff --git a/src/polyline_hull.scad b/src/polyline_hull.scad new file mode 100644 index 00000000..bb8feb64 --- /dev/null +++ b/src/polyline_hull.scad @@ -0,0 +1,25 @@ +module polyline_hull(points) { + leng = len(points); + + module hull_line(index) { + hull() { + translate(points[index - 1]) + children(); + translate(points[index]) + children(); + } + } + + if($children == 1) { + for(i = [1:leng - 1]) { + hull_line(i) + children(); + } + } + else { + for(i = [1:leng - 1]) { + hull_line(i) + children(i); + } + } +} \ No newline at end of file