repeeat last point of trace if close enough to close
This commit is contained in:
parent
82a429c13a
commit
e2c5fc4a98
3 changed files with 13 additions and 3 deletions
|
|
@ -447,6 +447,7 @@ function trace_noodle(noodle, noodleWidth, minR, midR, maxR, opt = {}) {
|
|||
if (poly.parent) {
|
||||
inner.push(nupoly);
|
||||
}
|
||||
let fpo;
|
||||
poly.segment(minR).forEachSegment((p1, p2) => {
|
||||
let np1 = { x:(p1.x+p2.x)/2, y:(p1.y+p2.y)/2 };
|
||||
let len = pointDist(p1, p2);
|
||||
|
|
@ -507,8 +508,14 @@ function trace_noodle(noodle, noodleWidth, minR, midR, maxR, opt = {}) {
|
|||
if (odd && !mp1.claimed) {
|
||||
mp1.claimed = true;
|
||||
}
|
||||
// store first trace out for this poly to repeat at the end
|
||||
fpo = fpo ?? trace.peek();
|
||||
}
|
||||
});
|
||||
// repeat first point of trace (if close enough to be closed)
|
||||
if (fpo && pointDist(fpo, trace.peek()) <= maxR) {
|
||||
trace.push(fpo);
|
||||
}
|
||||
}
|
||||
|
||||
// subtract inner extrusion offsets from parent extrusion offset
|
||||
|
|
|
|||
|
|
@ -1001,10 +1001,14 @@ function doRender(slice, isSynth, params, opt = {}) {
|
|||
.setLayer(isSynth ? "support" : "shells", isSynth ? Color.support : Color.shell)
|
||||
.addPolys(top.shells || [], vopt({ offset, height, clean: true }));
|
||||
|
||||
if (top.thin_wall?.length) output
|
||||
if (isThin && top.thin_wall?.length) output
|
||||
.setLayer("walls", Color.thin)
|
||||
.addPolys(top.thin_wall.map(p => newPolygon().centerCircle(p, p.r, 12).setZ(slice.z)), vopt({ offset, height }));
|
||||
|
||||
if (!isThin && top.thin_wall?.length) output
|
||||
.setLayer("walls", Color.thin)
|
||||
.addPolys(top.thin_wall.map(p => newPolygon().centerCircle(p, p.r, 3).setZ(slice.z)), vopt({ offset, height }));
|
||||
|
||||
if (top.fill_lines?.length) output
|
||||
.setLayer("solid fill", isSynth ? Color.support : Color.fill)
|
||||
.addLines(top.fill_lines || [], vopt({ offset: offset * solidWidth, height, z:slice.z }));
|
||||
|
|
|
|||
Loading…
Reference in a new issue