fix inside tabs. add tabs to shadow so moves always avoid them

This commit is contained in:
Stewart Allen 2020-11-28 00:07:38 -05:00
commit 8a29428f78
2 changed files with 23 additions and 7 deletions

View file

@ -306,15 +306,16 @@
const outside = POLY.offset(shadow.clone(), roughToolDiam * proc.camRoughOver, {z: slice.z});
if (outside) {
offset.appendAll(outside);
if (tabs) {
tabs.forEach(tab => {
tab.off = POLY.expand([tab.poly], roughToolDiam / 2).flat();
});
offset = cutTabs(tabs, offset, slice.z);
}
}
}
if (tabs) {
tabs.forEach(tab => {
tab.off = POLY.expand([tab.poly], roughToolDiam / 2).flat();
});
offset = cutTabs(tabs, offset, slice.z);
}
if (!offset) return;
slice.camLines = offset;
@ -477,6 +478,21 @@
sliceAll.forEach((slice, index) => slice.index = index);
// used in printSetup()
// used in CAM.prepare.getZClearPath()
// add tabs to terrain tops so moves avoid them
if (tabs) {
terrain.forEach(slab => {
tabs.forEach(tab => {
if (tab.pos.z + tab.dim.z/2 >= slab.z) {
let all = [...slab.tops, tab.poly];
slab.tops = POLY.union(all, 0, true);
// slab.slice.output()
// .setLayer("debug-tabs", {line: 0x880088, thin: true })
// .addPolys(POLY.setZ(slab.tops.clone(true), slab.z), { thin: true });
}
});
});
}
widget.terrain = terrain;
widget.maxToolDiam = maxToolDiam;