fix thin lines and fill offset. fix noodle render and z layer moves

This commit is contained in:
Stewart Allen 2020-11-01 23:01:43 -05:00
commit 49cde21201
4 changed files with 12 additions and 9 deletions

View file

@ -502,8 +502,8 @@
/**
* @returns {number} z value of first point
*/
PRO.getZ = function() {
return this.points[0].z;
PRO.getZ = function(i) {
return this.points[i || 0].z;
};
/**

View file

@ -528,6 +528,7 @@
opt.gaps.push(suba);
}
// if offset fails, consider last polygons as gap areas
if (opt.gaps && !polys.length) {
opt.gaps.push(orig);
}
@ -547,11 +548,6 @@
}
}
// if the polys fail to offset at the top level, consider them gaps
if (opt.gaps && polys.length === 0 && depth === 0) {
opt.gaps.push(orig);
}
return polys;
}

View file

@ -392,8 +392,12 @@
oso.outs.forEach((polys, i) => {
polys.forEach(p => {
p.depth = i;
if (p.inner) {
p.inner.forEach(pi => pi.depth = i);
}
top.traces.push(p);
});
last = polys;
});
// slice.solids.trimmed = slice.solids.trimmed || [];
@ -624,7 +628,9 @@
// fill intersected areas
if (inter.length) {
scope.isSparseFill = true;
if (!top.fill_lines) top.fill_lines = [];
if (!top.fill_lines) {
top.fill_lines = [];
}
inter.forEach(p => {
p.forEachSegment((p1, p2) => {
top.fill_lines.push(p1, p2);

View file

@ -1371,7 +1371,8 @@
if (opt.aslines) {
emits.poly(poly, opt.color || color, false, true);
} else {
emits.noodle_open(poly, off - 0.02, color, 0x0, poly.getZ());
// first point may be from the layer below, so use second point
emits.noodle_open(poly, off - 0.02, color, 0x0, poly.getZ(1));
}
});
emits.renderAll();