From 2ba17bacf736dc1a30805073d0a572b9b94048a6 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 3 May 2022 18:41:09 +0800 Subject: [PATCH] refactor --- src/voronoi/_impl/_convex_intersection.scad | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/voronoi/_impl/_convex_intersection.scad b/src/voronoi/_impl/_convex_intersection.scad index 9339b281..6ade2b6f 100644 --- a/src/voronoi/_impl/_convex_intersection.scad +++ b/src/voronoi/_impl/_convex_intersection.scad @@ -6,9 +6,10 @@ use <../../util/set/hashset_elems.scad>; include <../../__comm__/_pt2_hash.scad>; function _in_convex_r(s, convex_pts, pt, leng, i = 0) = - i + 1 == leng || - s * cross(convex_pts[i] - pt, convex_pts[i + 1] - pt) > 0 && - _in_convex_r(s, convex_pts, pt, leng, i + 1); + let(i1 = i + 1) + i1 == leng || + s * cross(convex_pts[i] - pt, convex_pts[i1] - pt) > 0 && + _in_convex_r(s, convex_pts, pt, leng, i1); function _in_convex(convex_pts, pt) = let(leng = len(convex_pts))