1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-12 01:34:12 +02:00
This commit is contained in:
Justin Lin
2022-04-23 17:19:33 +08:00
parent 712ca010a1
commit a8dd6c1af8

View File

@@ -66,9 +66,11 @@ function delaunay_addpoint(d, p, _indices_hash) =
boundaries = delaunayBoundaries(ndelaunay, badTriangles, _indices_hash), boundaries = delaunayBoundaries(ndelaunay, badTriangles, _indices_hash),
ndelaunay2 = delBadTriangles(ndelaunay, badTriangles, _indices_hash), ndelaunay2 = delBadTriangles(ndelaunay, badTriangles, _indices_hash),
newTriangles = [ newTriangles = [
for(b = boundaries) [ for(b = boundaries)
[idx, b[0][0], b[0][1], ihash(idx, b[0][0], b[0][1])], // t let(edge = b[0])
b[0], // edge [
[idx, edge[0], edge[1], ihash(idx, edge[0], edge[1])], // t
edge,
b[1] // delaunayTri b[1] // delaunayTri
] ]
] ]
@@ -84,8 +86,8 @@ function adjustNeighbors(d, newTriangles, _indices_hash) =
], ],
ncs = [ ncs = [
for(nt = newTriangles) for(nt = newTriangles)
let(nt0 = nt[0]) let(t = nt[0])
[nt0, _tri_circumcircle([coords[nt0[0]], coords[nt0[1]], coords[nt0[2]]])] [t, _tri_circumcircle([coords[t[0]], coords[t[1]], coords[t[2]]])]
], ],
nd = [ nd = [
coords, coords,
@@ -165,8 +167,8 @@ function delaunayBadTriangles(d, p, _indices_hash) =
) )
[ [
for(t = hashmap_keys(triangles)) for(t = hashmap_keys(triangles))
if(inCircumcircle(t, p, circles, _indices_hash)) if(inCircumcircle(t, p, circles, _indices_hash))
t t
]; ];
/* /*
@@ -229,4 +231,5 @@ function _tri_delaunay(d, points, leng, _indices_hash, i = 0) =
i == leng ? d : i == leng ? d :
_tri_delaunay( _tri_delaunay(
delaunay_addpoint(d, points[i], _indices_hash), delaunay_addpoint(d, points[i], _indices_hash),
points, leng, _indices_hash, i + 1); points, leng, _indices_hash, i + 1
);