From 3f504c0034b9d5bdba788b4226286c699ff34172 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 14 May 2022 14:55:31 +0800 Subject: [PATCH] get tri from conn_indices_tris --- src/surface/sf_thickenT.scad | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/surface/sf_thickenT.scad b/src/surface/sf_thickenT.scad index 88ddfbd1..d7a7cde4 100644 --- a/src/surface/sf_thickenT.scad +++ b/src/surface/sf_thickenT.scad @@ -30,8 +30,11 @@ module sf_thickenT(points, thickness, triangles = undef, direction = "BOTH", con mid_pt = sorted(points)[leng_pts / 2]; mid_i = search([mid_pt], points)[0]; indices = search(mid_i, conn_indices_tris, num_returns_per_match = 0); - connected_tris = [for(j = indices) conn_indices_tris[j][1]]; - nvs = [for(tri = connected_tris) _face_normal([for(i = [2, 1, 0]) points[tri[i]]])]; // OpenSCAD requires clockwise + nvs = [ + for(j = indices) + let(tri = conn_indices_tris[j][1]) + _face_normal([for(i = [2, 1, 0]) points[tri[i]]]) // OpenSCAD requires clockwise + ]; nv = sum(nvs) / len(nvs); off = dir_v * thickness; @@ -49,9 +52,9 @@ module sf_thickenT(points, thickness, triangles = undef, direction = "BOTH", con for(i = [0:leng_pts - 1]) let( indices = search(i, conn_indices_tris, num_returns_per_match = 0), - connected_tris = [for(j = indices) conn_indices_tris[j][1]], face_normals = [ - for(tri = connected_tris) + for(j = indices) + let(tri = conn_indices_tris[j][1]) _face_normal([for(k = [2, 1, 0]) points[tri[k]]]) // OpenSCAD requires clockwise ] )