1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-19 13:01:37 +02:00

don't sort

This commit is contained in:
Justin Lin
2022-04-04 20:47:48 +08:00
parent c3425143c3
commit d2a936a5a3

View File

@@ -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);