1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-22 22:35:18 +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,12 +1,12 @@
use <_convex_intersection.scad>; use <_convex_intersection.scad>;
function _convex_intersection_for_impl(shapes, pre, leng, i = 2) = function _convex_intersection_for_impl(shapes, pre, leng, i = 2) =
i == leng ? pre : pre == [] || i == leng ? pre :
let(r = _convex_intersection(pre, shapes[i])) _convex_intersection_for_impl(
r == [] ? r shapes,
: _convex_intersection_for_impl(shapes, _convex_intersection(pre, shapes[i]),
r, leng,
leng, i + 1 i + 1
); );
function _convex_intersection_for(shapes) = function _convex_intersection_for(shapes) =