1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-22 14:23:23 +02:00

stop if []

This commit is contained in:
Justin Lin
2020-02-28 16:22:16 +08:00
parent fbbc0f0796
commit a7d65e55bd
2 changed files with 7 additions and 4 deletions

View File

@@ -2,7 +2,9 @@ use <experimental/convex_intersection.scad>;
function _convex_intersection_for(shapes, pre, leng, i = 2) = function _convex_intersection_for(shapes, pre, leng, i = 2) =
i == leng ? pre : i == leng ? pre :
_convex_intersection_for(shapes, let(r = convex_intersection(pre, shapes[i]))
convex_intersection(pre, shapes[i]), r == [] ? []
leng, i + 1 : _convex_intersection_for(shapes,
); r,
leng, i + 1
);

View File

@@ -4,6 +4,7 @@ use <experimental/_impl/_convex_intersection_impl.scad>;
use <experimental/convex_ct_clk_order.scad>; use <experimental/convex_ct_clk_order.scad>;
function convex_intersection(shape1, shape2, epsilon = 0.0001) = function convex_intersection(shape1, shape2, epsilon = 0.0001) =
(shape1 == [] || shape2 == []) ? [] :
let( let(
leng = len(shape1), leng = len(shape1),
pts = concat(shape1, [shape1[0]]) pts = concat(shape1, [shape1[0]])