mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-22 14:23:23 +02:00
tail recursion
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
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) =
|
||||||
let(leng = len(shapes))
|
let(leng = len(shapes))
|
||||||
|
Reference in New Issue
Block a user