diff --git a/src/util/_impl/_sort_impl.scad b/src/util/_impl/_sort_impl.scad index 051922b6..c6c1266c 100644 --- a/src/util/_impl/_sort_impl.scad +++ b/src/util/_impl/_sort_impl.scad @@ -1,6 +1,6 @@ use ; -function _default_sort(lt) = +function _vt_sort(lt) = let(leng = len(lt)) leng <= 1 ? lt : let( @@ -8,9 +8,9 @@ function _default_sort(lt) = before = [for(j = 1; j < leng; j = j + 1) if(lessThan(lt[j], pivot)) lt[j]], after = [for(j = 1; j < leng; j = j + 1) if(greaterThan(lt[j], pivot) || lt[j] == pivot) lt[j]] ) - concat(_default_sort(before), [pivot], _default_sort(after)); + concat(_vt_sort(before), [pivot], _vt_sort(after)); -function _sort(lt, i) = +function _sort_by_idx(lt, i) = let(leng = len(lt)) leng <= 1 ? lt : let( @@ -18,9 +18,9 @@ function _sort(lt, i) = before = [for(j = 1; j < leng; j = j + 1) if(lt[j][i] < pivot[i]) lt[j]], after = [for(j = 1; j < leng; j = j + 1) if(lt[j][i] >= pivot[i]) lt[j]] ) - concat(_sort(before, i), [pivot], _sort(after, i)); + concat(_sort_by_idx(before, i), [pivot], _sort_by_idx(after, i)); -function _sort_impl(lt, by, idx) = +function _sort_by(lt, by, idx) = let( dict = [["x", 0], ["y", 1], ["z", 2], ["i", idx]], i = dict[search(by == "idx" ? "i" : by, dict)[0]][1] diff --git a/src/util/sort.scad b/src/util/sort.scad index fb5ba7f0..8379ae58 100644 --- a/src/util/sort.scad +++ b/src/util/sort.scad @@ -11,5 +11,5 @@ use ; function sort(lt, by = "idx", idx = 0) = - by == "vt" ? _default_sort(lt) : // for example, sort by zyx for a list of points - _sort_impl(lt, by, idx); \ No newline at end of file + by == "vt" ? _vt_sort(lt) : // for example, sort by zyx for a list of points + _sort_by(lt, by, idx); \ No newline at end of file