From fee3cb0d80f5d195c99520d193757a6cf092c6b8 Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Sat, 19 Jun 2021 23:21:52 -0700 Subject: [PATCH] Fix for issue #429 --- paths.scad | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/paths.scad b/paths.scad index 73ed488..2c3a2b3 100644 --- a/paths.scad +++ b/paths.scad @@ -661,7 +661,7 @@ function path_self_intersections(path, closed=true, eps=EPSILON) = path = cleanup_path(path, eps=eps), plen = len(path) ) [ - for (i = [0:1:plen-(closed?2:3)], j=[i+1:1:plen-(closed?1:2)]) let( + for (i = [0:1:plen-(closed?2:3)], j=[i+2:1:plen-(closed?1:2)]) let( a1 = path[i], a2 = path[(i+1)%plen], b1 = path[j], @@ -675,15 +675,16 @@ function path_self_intersections(path, closed=true, eps=EPSILON) = c = a1-a2, d = b1-b2, denom = (c.x*d.y)-(c.y*d.x) - ) abs(denom)eps && isect[1]<=1+eps && - isect[2]>eps && isect[2]<=1+eps + isect[1]>=-eps && isect[1]<=1+eps && + isect[2]>=-eps && isect[2]<=1+eps ) [isect[0], i, isect[1], j, isect[2]] ];