1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 10:14:41 +02:00
This commit is contained in:
Justin Lin
2022-03-12 17:52:05 +08:00
parent ed01eebf16
commit 3cb77f3a7a
2 changed files with 18 additions and 15 deletions

View File

@@ -277,4 +277,4 @@ function create_stack(elem) = [elem, []];
function stack_push(stack, elem) = [elem, stack]; function stack_push(stack, elem) = [elem, stack];
// function stack_pop(stack) = stack; // function stack_pop(stack) = stack;
function stack_len(stack) = function stack_len(stack) =
stack[0] == undef ? 0 : (1 + stack_len(stack[1])); is_undef(stack[0]) ? 0 : 1 + stack_len(stack[1]);

View File

@@ -89,7 +89,8 @@ function adjustNeighbors(d, newTriangles, _indices_hash) =
], ],
ncs = [ ncs = [
for(nt = newTriangles) for(nt = newTriangles)
[nt[0], _tri_circumcircle([for(i = [0:2]) coords[nt[0][i]]])] let(nt0 = nt[0])
[nt0, _tri_circumcircle([coords[nt0[0]], coords[nt0[1]], coords[nt0[2]]])]
], ],
nd = [ nd = [
coords, coords,
@@ -126,9 +127,9 @@ function _adjustNeighborsDtri(d, newTriangles, leng, _indices_hash, i = 0) =
let( let(
t = newTriangles[i][0], t = newTriangles[i][0],
edge = newTriangles[i][1], edge = newTriangles[i][1],
delaunayTri = newTriangles[i][2] delaunayTri = newTriangles[i][2],
) rd = is_undef(delaunayTri) ? d :
delaunayTri != undef ? (
let( let(
neighbors = hashmap_get(delaunay_triangles(d), delaunayTri, hash = _indices_hash), neighbors = hashmap_get(delaunay_triangles(d), delaunayTri, hash = _indices_hash),
leng_nbrs = len(neighbors), leng_nbrs = len(neighbors),
@@ -138,8 +139,10 @@ function _adjustNeighborsDtri(d, newTriangles, leng, _indices_hash, i = 0) =
j == nbri ? t : neighbors[j] j == nbri ? t : neighbors[j]
], _indices_hash) ], _indices_hash)
) )
_adjustNeighborsDtri(nd, newTriangles, leng, _indices_hash, i + 1) : nd
_adjustNeighborsDtri(d, newTriangles, leng, _indices_hash, i + 1); )
)
_adjustNeighborsDtri(rd, newTriangles, leng, _indices_hash, i + 1);
function updateNbrs(d, delaunayTri, neighbors, _indices_hash) = function updateNbrs(d, delaunayTri, neighbors, _indices_hash) =
let( let(