From a7d65e55bde9cd1d1ab34b528acb6588e6b99bed Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 28 Feb 2020 16:22:16 +0800 Subject: [PATCH] stop if [] --- .../_impl/_convex_intersection_for_impl.scad | 10 ++++++---- src/experimental/convex_intersection.scad | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/experimental/_impl/_convex_intersection_for_impl.scad b/src/experimental/_impl/_convex_intersection_for_impl.scad index 78e4a48f..b8b4bbc3 100644 --- a/src/experimental/_impl/_convex_intersection_for_impl.scad +++ b/src/experimental/_impl/_convex_intersection_for_impl.scad @@ -2,7 +2,9 @@ use ; function _convex_intersection_for(shapes, pre, leng, i = 2) = i == leng ? pre : - _convex_intersection_for(shapes, - convex_intersection(pre, shapes[i]), - leng, i + 1 - ); \ No newline at end of file + let(r = convex_intersection(pre, shapes[i])) + r == [] ? [] + : _convex_intersection_for(shapes, + r, + leng, i + 1 + ); \ No newline at end of file diff --git a/src/experimental/convex_intersection.scad b/src/experimental/convex_intersection.scad index f3311815..dc3d2207 100644 --- a/src/experimental/convex_intersection.scad +++ b/src/experimental/convex_intersection.scad @@ -4,6 +4,7 @@ use ; use ; function convex_intersection(shape1, shape2, epsilon = 0.0001) = + (shape1 == [] || shape2 == []) ? [] : let( leng = len(shape1), pts = concat(shape1, [shape1[0]])