1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00

get tri from conn_indices_tris

This commit is contained in:
Justin Lin 2022-05-14 14:55:31 +08:00
parent cbb8268456
commit 3f504c0034

View File

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