fix shell depth cues used for extrusion speed

This commit is contained in:
Stewart Allen 2021-03-12 14:44:05 -05:00
commit 4a0a000ef9
2 changed files with 20 additions and 0 deletions

View file

@ -550,6 +550,7 @@
let total = count; let total = count;
let layers = []; let layers = [];
let ref = polys; let ref = polys;
let depth = 0;
while (count-- > 0 && ref && ref.length) { while (count-- > 0 && ref && ref.length) {
let off = offset(ref, -dist, {z}); let off = offset(ref, -dist, {z});
let mid = offset(off, dist / 2, {z}); let mid = offset(off, dist / 2, {z});
@ -563,6 +564,15 @@
subtract(ref, cmp, gap, null, z); subtract(ref, cmp, gap, null, z);
} }
layers.push({idx: total-count, off, mid, gap}); layers.push({idx: total-count, off, mid, gap});
// fixup depth cues
for (let m of mid) {
m.depth = depth++;
if (m.inner) {
for (let mi of m.inner) {
mi.depth = m.depth;
}
}
}
ref = off; ref = off;
} }
return layers; return layers;

View file

@ -609,6 +609,11 @@
if (p.fill_off) { if (p.fill_off) {
p.fill_off.forEach(pi => pi.depth = i); p.fill_off.forEach(pi => pi.depth = i);
} }
if (p.inner) {
for (let pi of p.inner) {
pi.depth = p.depth;
}
}
top.shells.push(p); top.shells.push(p);
}); });
last = polys; last = polys;
@ -643,6 +648,11 @@
// use negative offset for inners // use negative offset for inners
pi.depth = -(count - countNow); pi.depth = -(count - countNow);
}); });
if (p.inner) {
for (let pi of p.inner) {
pi.depth = p.depth;
}
}
}); });
}); });
} }