tweaks to xray, debug. add poly dep to mesh for topo mod

This commit is contained in:
Stewart Allen 2022-06-16 18:24:49 -04:00
commit f233bc2768
9 changed files with 47 additions and 9 deletions

View file

@ -7,7 +7,7 @@
// use: ext.clip2
// use: geo.slope
// use: geo.polygon
gapp.register("base.polygons", [], (root, exports) => {
gapp.register("geo.polygons", [], (root, exports) => {
const { base } = root;
const { util, config, newPoint } = base;
@ -388,7 +388,7 @@ function subtract(setA, setB, outA, outB, z, minArea, opt = {}) {
}
}
let out = polys.slice(), i, j, union, uset = [];
let out = polys.slice(), i, j, union, uset = [], a, b;
outer: for (i=0; i<out.length; i++) {
if (!out[i]) continue;
@ -396,6 +396,10 @@ function subtract(setA, setB, outA, outB, z, minArea, opt = {}) {
if (!out[j]) continue;
union = out[i].union(out[j], minarea, all);
if (union && union.length) {
if (opt.onmerge) {
a = out[i];
b = out[j];
}
out[i] = null;
out[j] = null;
if (all) {
@ -403,6 +407,9 @@ function subtract(setA, setB, outA, outB, z, minArea, opt = {}) {
} else {
out.push(union);
}
if (opt.onmerge) {
opt.onmerge(a, b, union);
}
continue outer;
}
}