attempt to improve roughing route planning by handling all 'inner' polys first

This commit is contained in:
Stewart Allen 2021-03-16 18:19:46 -04:00
commit 7981e522f6
2 changed files with 15 additions and 9 deletions

View file

@ -41,6 +41,7 @@
* `F` apply finish speed to exposed top and underside flat areas * `F` apply finish speed to exposed top and underside flat areas
* `F` expand internal supporting flats / solids before projection * `F` expand internal supporting flats / solids before projection
* `P` refactor skirt, brim, raft as synth widget instead of in path routing
* `P` extruder + filament max flow rate cap in planner * `P` extruder + filament max flow rate cap in planner
* `P` revisit path routing / optimization * `P` revisit path routing / optimization
* `P` implement infill clipping in wasm * `P` implement infill clipping in wasm

View file

@ -253,6 +253,7 @@
if (!roughIn) { if (!roughIn) {
const outside = POLY.offset(shadow.clone(), toolDiam / 2, {z: slice.z}); const outside = POLY.offset(shadow.clone(), toolDiam / 2, {z: slice.z});
if (outside) { if (outside) {
outside.forEach(p => p.depth = -p.depth);
offset.appendAll(outside); offset.appendAll(outside);
} }
} }
@ -371,18 +372,22 @@
} }
} }
function isNeg(v) {
return v < 0 || (v === 0 && 1/v === -Infinity);
}
if (depthFirst) { if (depthFirst) {
let tops = depthData.map(level => { let ease = danger && op.down && easeDown ? op.down : 0;
// return POLY.nest(level.filter(poly => poly.depth === 0)); let ins = depthData.map(a => a.filter(p => !isNeg(p.depth)));
let itops = ins.map(level => {
return POLY.nest(level.filter(poly => poly.depth === 0).clone()); return POLY.nest(level.filter(poly => poly.depth === 0).clone());
}); });
// experimental start of ease down let outs = depthData.map(a => a.filter(p => isNeg(p.depth)));
let ease = danger && op.down && easeDown ? op.down : 0; let otops = outs.map(level => {
printPoint = depthRoughPath(printPoint, 0, depthData, tops, polyEmit, false, ease); return POLY.nest(level.filter(poly => poly.depth === 0).clone());
// printPoint = depthRoughPath(printPoint, 0, depthData, tops, (poly, index, count, start) => { });
// console.log({z: poly.getZ(), i: poly.id, index, poly}); printPoint = depthRoughPath(printPoint, 0, ins, itops, polyEmit, false, ease);
// return polyEmit(poly, index, count, start); printPoint = depthRoughPath(printPoint, 0, outs, otops, polyEmit, false, ease);
// });
} }
setPrintPoint(printPoint); setPrintPoint(printPoint);