From 969f17f4c6554757348f5333e04fe7337e12b384 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Fri, 6 Dec 2019 19:14:03 -0800 Subject: [PATCH] Bugfix for polygon_shift_to_closest_point() --- geometry.scad | 8 +++----- version.scad | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/geometry.scad b/geometry.scad index b346ea6..bee155c 100644 --- a/geometry.scad +++ b/geometry.scad @@ -978,11 +978,9 @@ function polygon_shift(poly, i) = function polygon_shift_to_closest_point(path, pt) = let( path = cleanup_path(path), - closest = path_closest_point(path,pt), - seg = select(path,closest[0],closest[0]+1), - u = norm(closest[1]-seg[0]) / norm(seg[1]-seg[0]), - segnum = closest[0] + (u>0.5? 1 : 0) - ) select(path,segnum,segnum+len(path)-1); + dists = [for (p=path) norm(p-pt)], + closest = min_index(dists) + ) select(path,closest,closest+len(path)-1); // Function: reindex_polygon() diff --git a/version.scad b/version.scad index 7b5b09b..f3c3926 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,54]; +BOSL_VERSION = [2,0,55]; // Section: BOSL Library Version Functions