Bugfix for polygon_shift_to_closest_point()

This commit is contained in:
Revar Desmera 2019-12-06 19:14:03 -08:00
parent 24de174d6f
commit 969f17f4c6
2 changed files with 4 additions and 6 deletions

View file

@ -978,11 +978,9 @@ function polygon_shift(poly, i) =
function polygon_shift_to_closest_point(path, pt) = function polygon_shift_to_closest_point(path, pt) =
let( let(
path = cleanup_path(path), path = cleanup_path(path),
closest = path_closest_point(path,pt), dists = [for (p=path) norm(p-pt)],
seg = select(path,closest[0],closest[0]+1), closest = min_index(dists)
u = norm(closest[1]-seg[0]) / norm(seg[1]-seg[0]), ) select(path,closest,closest+len(path)-1);
segnum = closest[0] + (u>0.5? 1 : 0)
) select(path,segnum,segnum+len(path)-1);
// Function: reindex_polygon() // Function: reindex_polygon()

View file

@ -8,7 +8,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,54]; BOSL_VERSION = [2,0,55];
// Section: BOSL Library Version Functions // Section: BOSL Library Version Functions