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

tail recursion

This commit is contained in:
Justin Lin
2022-05-03 16:49:01 +08:00
parent c97b5a9ed0
commit b7bc803849

View File

@@ -1,13 +1,13 @@
use <_convex_intersection.scad>;
function _convex_intersection_for_impl(shapes, pre, leng, i = 2) =
i == leng ? pre :
let(r = _convex_intersection(pre, shapes[i]))
r == [] ? r
: _convex_intersection_for_impl(shapes,
r,
leng, i + 1
);
pre == [] || i == leng ? pre :
_convex_intersection_for_impl(
shapes,
_convex_intersection(pre, shapes[i]),
leng,
i + 1
);
function _convex_intersection_for(shapes) =
let(leng = len(shapes))