From 5c833132038049456feedf4d89567ed897f4d7d6 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Mon, 9 Mar 2020 01:04:46 -0700 Subject: [PATCH] Minor stroke() bugfix. --- shapes2d.scad | 20 +++++++++++++------- version.scad | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/shapes2d.scad b/shapes2d.scad index 7ad488d..255f4c2 100644 --- a/shapes2d.scad +++ b/shapes2d.scad @@ -174,14 +174,16 @@ module stroke( [lerp(width[epos[0]], width[(epos[0]+1)%len(width)], epos[1])] ); - if (is_path(path,2)) { + if (len(path[0]) == 2) { // Straight segments for (i = idx(path2,end=-2)) { seg = select(path2,i,i+1); delt = seg[1] - seg[0]; - translate(seg[0]) - rot(from=BACK,to=delt) + translate(seg[0]) { + rot(from=BACK,to=delt) { trapezoid(w1=widths[i], w2=widths[i+1], h=norm(delt), anchor=FRONT); + } + } } // Joints @@ -217,17 +219,21 @@ module stroke( for (i = idx(path2,end=-2)) { seg = select(path2,i,i+1); delt = seg[1] - seg[0]; - translate(seg[0]) - rot(from=UP,to=delt) + translate(seg[0]) { + rot(from=UP,to=delt) { cylinder(r1=widths[i]/2, r2=widths[i+1]/2, h=norm(delt), center=false); + } + } } // Joints for (i = [1:1:len(path2)-2]) { $fn = quantup(segs(widths[i]/2),4); - translate(path2[i]) - rot(from=UP, to=path2[i]-path2[i-1]) + translate(path2[i]) { + rot(from=UP, to=path2[i]-path2[i-1]) { sphere(d=widths[i]); + } + } } // Endcap1 diff --git a/version.scad b/version.scad index dd25daa..e810c87 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,169]; +BOSL_VERSION = [2,0,170]; // Section: BOSL Library Version Functions