add missing flats to master shadow. fix z min slice in rough and outline

This commit is contained in:
Stewart Allen 2020-11-21 20:31:37 -05:00
commit 2c30d1f28e
2 changed files with 13 additions and 4 deletions

View file

@ -400,13 +400,21 @@
}
if (opt.flats && opt.off) {
let add = [];
Object.keys(this.zFlat).forEach(z => {
z = parseFloat(z);
add.push(z + opt.off);
if (z > zmin) {
add.push(z - opt.off);
}
});
// add over and under all flats by 'off'
array.appendAll(Object.keys(this.zFlat).map(v => parseFloat(v))).sort((a,b) => {
array.appendAll(add).sort((a,b) => {
return opt.down ? b-a : a-b;
});
}
return array.map(v => parseFloat(v.toFixed(2)));
return array.map(v => Math.abs(parseFloat(v.toFixed(2))));
}
}

View file

@ -175,7 +175,7 @@
let flats = [];
let shadow = [];
let slices = [];
let indices = slicer.interval(roughDown, { down: true, min: zBottom, fit: true });
let indices = slicer.interval(roughDown, { down: true, min: zBottom, fit: true, boff: 0.01 });
if (proc.camRoughFlat) {
let flats = Object.keys(slicer.zFlat)
.map(v => parseFloat(v).round(4))
@ -206,6 +206,7 @@
.filter(v => v > 0 && indices.indexOf(v) < 0);
indices = indices.appendAll(flats).sort((a,b) => b-a);
}
// console.log('indices', ...indices, {zBottom});
slicer.slice(indices, { each: (data, index, total) => {
shadow = POLY.union(shadow.appendAll(data.tops), 0.01, true);
@ -309,7 +310,7 @@
let shadow = [];
let slices = [];
let indices = slicer.interval(outlineDown, { down: true, min: zBottom, fit: true });
let indices = slicer.interval(outlineDown, { down: true, min: zBottom, fit: true, boff: 0.01 });
// add flats to shadow
const flats = Object.keys(slicer.zFlat)
.map(v => (parseFloat(v) - 0.01).round(5))