From 5ece18500aac77d20f5040a8293b95964bce77b9 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 2 May 2017 17:57:16 +0800 Subject: [PATCH] supported twist --- src/path_extrude.scad | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/path_extrude.scad b/src/path_extrude.scad index df71e700..7fb51168 100644 --- a/src/path_extrude.scad +++ b/src/path_extrude.scad @@ -13,7 +13,7 @@ * **/ -module path_extrude(shape_pts, path_pts, triangles = "RADIAL", scale = 1.0) { +module path_extrude(shape_pts, path_pts, triangles = "RADIAL", twist = 0, scale = 1.0) { function first_section() = let( p1 = path_pts[0], @@ -31,6 +31,7 @@ module path_extrude(shape_pts, path_pts, triangles = "RADIAL", scale = 1.0) { len_path_pts = len(path_pts); scale_step = (scale - 1) / (len_path_pts - 1); + twist_step = twist / (len_path_pts - 1); function section(p1, p2, i) = let( @@ -43,7 +44,11 @@ module path_extrude(shape_pts, path_pts, triangles = "RADIAL", scale = 1.0) { ) [ for(p = shape_pts) - rotate_p(p * (1 + scale_step * i) + [0, 0, length], [0, ay, az]) + p1 + rotate_p( + rotate_p(p * (1 + scale_step * i), twist_step * i) + [0, 0, length], + [0, ay, az] + ) + p1 + //rotate_p(p * (1 + scale_step * i) + [0, 0, length], [0, ay, az]) + p1 ];