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
|
|
@ -192,7 +192,7 @@ async function path(levels, update, opts = {}) {
|
|||
// Math.abs(op.y - lp.y),
|
||||
// Math.abs(op.z - lp.z));
|
||||
// if (moved < 0.0001) return;
|
||||
if( is_cam() && (out.emit == 2 || out.emit == 3 )) { // cam arc emit
|
||||
if (is_cam() && (out.emit == 2 || out.emit == 3 )) { // cam arc emit
|
||||
// checks if a new poly should be started
|
||||
if (!lastOut.emit || (ckspeed && out.speed !== lastOut.speed) || lastEnd) {
|
||||
current = newPolygon().setOpen();
|
||||
|
|
@ -210,7 +210,6 @@ async function path(levels, update, opts = {}) {
|
|||
} else if (out.emit) {
|
||||
// explicity G1 in CAM mode
|
||||
// just a non-move in other modes
|
||||
|
||||
// checks if a new poly should be started
|
||||
if (!lastOut.emit || (ckspeed && out.speed !== lastOut.speed) || lastEnd) {
|
||||
current = newPolygon().setOpen();
|
||||
|
|
|
|||
|
|
@ -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