1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-21 14:04:53 +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) =
i == leng ? pre :
_convex_intersection_for(shapes,
convex_intersection(pre, shapes[i]),
leng, i + 1
);
let(r = convex_intersection(pre, shapes[i]))
r == [] ? []
: _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>;
function convex_intersection(shape1, shape2, epsilon = 0.0001) =
(shape1 == [] || shape2 == []) ? [] :
let(
leng = len(shape1),
pts = concat(shape1, [shape1[0]])