From d2a936a5a37191b4140480bcb259c41904361ac6 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 4 Apr 2022 20:47:48 +0800 Subject: [PATCH] don't sort --- src/surface/sf_thickenT.scad | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/surface/sf_thickenT.scad b/src/surface/sf_thickenT.scad index c7a077e3..c215e420 100644 --- a/src/surface/sf_thickenT.scad +++ b/src/surface/sf_thickenT.scad @@ -16,12 +16,10 @@ use <../triangle/tri_delaunay.scad>; module sf_thickenT(points, thickness, triangles = undef, direction = "BOTH", convexity = 1) { // triangles : counter-clockwise - real_triangles = is_undef(triangles) ? tri_delaunay([for(p = points) [p[0], p[1]]]) : triangles; + real_triangles = is_undef(triangles) ? tri_delaunay([for(p = points) [p.x, p.y]]) : triangles; tris = [for(tri = real_triangles) [tri[2], tri[1], tri[0]]]; - ascending = function(e1, e2) e1 - e2; - function connected_tris(leng_pts, triangles) = let( leng = len(triangles), @@ -32,10 +30,10 @@ module sf_thickenT(points, thickness, triangles = undef, direction = "BOTH", con function _connected_tris(triangles, leng, leng_pts, cnt_tris, i = 0) = i == leng ? cnt_tris : let( - tri = sort(triangles[i], by = ascending), + tri = triangles[i], n_cnt_tris = [ for(k = [0:leng_pts - 1]) - search([k], tri)[0] != [] ? [each cnt_tris[k], triangles[i]] : cnt_tris[k] + search([k], tri)[0] != [] ? [each cnt_tris[k], tri] : cnt_tris[k] ] ) _connected_tris(triangles, leng, leng_pts, n_cnt_tris, i + 1);