1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00

remove sort

This commit is contained in:
Justin Lin 2022-04-04 21:38:07 +08:00
parent 7c40e28e64
commit c981127471

View File

@ -1,11 +1,7 @@
use <_face_normal.scad>;
use <../util/slice.scad>;
use <../util/sort.scad>;
use <../util/sum.scad>;
ascending = function(e1, e2) e1 - e2;
function connected_faces(leng_pts, faces) =
let(cnt_faces = [for(i = [0:leng_pts - 1]) []])
_connected_faces(faces, len(faces), leng_pts, cnt_faces);
@ -13,10 +9,9 @@ function connected_faces(leng_pts, faces) =
function _connected_faces(faces, leng, leng_pts, cnt_faces, i = 0) =
i == leng ? cnt_faces :
let(
facei = sort(faces[i], by = ascending),
n_cnt_faces = [
for(k = [0:leng_pts - 1])
search([k], facei)[0] != [] ? [each cnt_faces[k], faces[i]] : cnt_faces[k]
search([k], faces[i])[0] != [] ? [each cnt_faces[k], faces[i]] : cnt_faces[k]
]
)
_connected_faces(faces, leng, leng_pts, n_cnt_faces, i + 1);