mark de-rez as experimental, remove comments

This commit is contained in:
Stewart Allen 2021-06-23 16:29:27 -04:00
commit 7072afb613

View file

@ -146,6 +146,13 @@
onSliceDoneAsync(slices).then(ondone); onSliceDoneAsync(slices).then(ondone);
} }
let lastlog = Date.now();
function logger() {
let now = Date.now();
console.log(now - lastlog, ...arguments);
lastlog = now;
}
async function doShadow(slices) { async function doShadow(slices) {
if (widget.shadow) { if (widget.shadow) {
return; return;
@ -157,20 +164,15 @@
let alllen = alltops.map(p => p.deepLength).reduce((a,v)=>a+v); let alllen = alltops.map(p => p.deepLength).reduce((a,v)=>a+v);
// de-rez for really large #s // de-rez for really large #s
if (alllen > 100000) { if (alllen > 100000) {
// console.log({alllen}); alltops = alltops.map(p => p.clean(true, undefined, CONF.clipper / 10));
alltops = alltops.map(p => p.clean(true, undefined, 5000));
// console.log({reduced: alltops.map(p => p.deepLength).reduce((a,v)=>a+v)});
} }
let mark = Date.now();
// shadow = POLY.union(alltops, 0.1, true);
shadow = doConcurrent ? shadow = doConcurrent ?
await KIRI.minions.union(alltops, 0.1) : await KIRI.minions.union(alltops, 0.1) :
POLY.union(alltops, 0.1, true); POLY.union(alltops, 0.1, true);
// console.log({unioned_in: Date.now() - mark});
if (spro.sliceSupportExtra) { if (spro.sliceSupportExtra) {
shadow = POLY.offset(shadow, spro.sliceSupportExtra); shadow = POLY.offset(shadow, spro.sliceSupportExtra);
} }
widget.shadow = shadow; widget.shadow = POLY.setZ(shadow, 0);
// slices[0].output() // slices[0].output()
// .setLayer('shadow', { line: 0xff0000, check: 0xff0000 }) // .setLayer('shadow', { line: 0xff0000, check: 0xff0000 })
// .addPolys(shadow); // .addPolys(shadow);
@ -525,7 +527,7 @@
doShadow(slices); doShadow(slices);
// console.log('start'); await BASE.util.ptimer(1000); // console.log('start'); await BASE.util.ptimer(1000);
forSlices(0.7, 0.8, slice => { forSlices(0.7, 0.8, slice => {
doSupport(slice, spro, widget.shadow); doSupport(slice, spro, widget.shadow, ctrl.danger);
}, "support"); }, "support");
// console.log('stop'); await BASE.util.ptimer(1000); // console.log('stop'); await BASE.util.ptimer(1000);
let promises = doConcurrent ? [] : undefined; let promises = doConcurrent ? [] : undefined;
@ -1158,7 +1160,7 @@
/** /**
* calculate external overhangs requiring support * calculate external overhangs requiring support
*/ */
function doSupport(slice, proc, shadow) { function doSupport(slice, proc, shadow, experimental) {
let maxBridge = proc.sliceSupportSpan || 5, let maxBridge = proc.sliceSupportSpan || 5,
minArea = proc.supportMinArea, minArea = proc.supportMinArea,
pillarSize = proc.sliceSupportSize, pillarSize = proc.sliceSupportSize,
@ -1182,7 +1184,7 @@
down_tops = down ? down.topPolys() : null, down_tops = down ? down.topPolys() : null,
down_traces = down ? POLY.flatten(down.topShells().clone(true)) : null; down_traces = down ? POLY.flatten(down.topShells().clone(true)) : null;
if (down_tops) { if (experimental && down_tops) {
// de-rez complex polys because it's not that important for supports // de-rez complex polys because it's not that important for supports
let points = down_tops.map(p => p.deepLength).reduce((a,v)=>a+v); let points = down_tops.map(p => p.deepLength).reduce((a,v)=>a+v);
if (points > 200) { if (points > 200) {