From 3ea9715bc4237ea5d1a886f83d2eaebb5df2bf2e Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 3 May 2022 19:31:01 +0800 Subject: [PATCH] all counter-clockwise? --- src/voronoi/_impl/_convex_intersection.scad | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/voronoi/_impl/_convex_intersection.scad b/src/voronoi/_impl/_convex_intersection.scad index 6ade2b6f..b1a79c7d 100644 --- a/src/voronoi/_impl/_convex_intersection.scad +++ b/src/voronoi/_impl/_convex_intersection.scad @@ -5,16 +5,17 @@ use <../../util/set/hashset_elems.scad>; include <../../__comm__/_pt2_hash.scad>; -function _in_convex_r(s, convex_pts, pt, leng, i = 0) = +function _in_convex_r(convex_pts, pt, leng, i = 0) = 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); + cross(convex_pts[i] - pt, convex_pts[i1] - pt) > 0 && + _in_convex_r(convex_pts, pt, leng, i1); function _in_convex(convex_pts, pt) = let(leng = len(convex_pts)) + // all counter-clockwise? + cross(convex_pts[leng - 1] - pt, convex_pts[0] - pt) > 0 && _in_convex_r( - cross(convex_pts[leng - 1] - pt, convex_pts[0] - pt), convex_pts, pt, leng