1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-19 04:51:26 +02:00

unify params

This commit is contained in:
Justin Lin
2020-03-20 07:22:02 +08:00
parent 3f26c2777a
commit eaaea18771
3 changed files with 2 additions and 10 deletions

View File

@@ -1,9 +1,3 @@
function _zip2(lt1, lt2) =
[for(i = [0:len(lt1) - 1]) [lt1[i], lt2[i]]];
function _zip3(lt1, lt2, lt3) =
[for(i = [0:len(lt1) - 1]) [lt1[i], lt2[i], lt3[i]]];
function _zipAll_sub(lists, list_to, elem_to, i = 0) =
i > elem_to ? [] :
concat([[for(j = [0:list_to]) lists[j][i]]], _zipAll_sub(lists, list_to, elem_to, i + 1));

View File

@@ -14,5 +14,5 @@ ys = pnoise1s(xs);
translate([0, 2])
hull_polyline2d(
zip(xs, ys), width = .1
zip([xs, ys]), width = .1
);

View File

@@ -1,5 +1,3 @@
use <experimental/_impl/_zip_impl.scad>;
function zip(lt, lt2, lt3) =
is_undef(lt2) ? _zipAll(lt) :
is_undef(lt3) ? _zip2(lt, lt2) : _zip3(lt, lt2, lt3);
function zip(lists) = _zipAll(lists);