diff --git a/src/geo/polygon.js b/src/geo/polygon.js index 9c017514..ac13b4d9 100644 --- a/src/geo/polygon.js +++ b/src/geo/polygon.js @@ -287,7 +287,13 @@ for (let i=0; i 90) { + if (d > 179) { + const s = slo[(i+pln) % pln]; + const pp = pa[(i+pln-1) % pln]; + const ps = slo[(i+pln-1) % pln]; + newp.push(p.follow(p.slopeTo(pp).normal(), 0.001)); + newp.push(p.follow(s.clone().normal().invert(), 0.001)); + } else if (d > 90) { const s = slo[(i+pln) % pln]; const pp = pa[(i+pln-1) % pln]; const ps = slo[(i+pln-1) % pln]; diff --git a/src/geo/slope.js b/src/geo/slope.js index 517008d9..6187cdce 100644 --- a/src/geo/slope.js +++ b/src/geo/slope.js @@ -44,6 +44,10 @@ return [this.dx, this.dy, this.angle].join(','); }; + PRO.clone = function() { + return new Slope(null, null, this.dx, this.dy); + }; + /** * @param {Slope} s * @returns {boolean} @@ -70,6 +74,13 @@ return this; }; + PRO.invert = function() { + this.dx = -this.dx; + this.dy = -this.dy; + this.angle = Math.atan2(this.dy, this.dx) * RAD2DEG; + return this; + } + PRO.toUnit = function() { let max = Math.max(ABS(this.dx), ABS(this.dy)); this.dx = this.dx / max; diff --git a/src/mode/fdm/prepare.js b/src/mode/fdm/prepare.js index 6710d352..927af606 100644 --- a/src/mode/fdm/prepare.js +++ b/src/mode/fdm/prepare.js @@ -491,8 +491,12 @@ if (lastOut.emit !== out.emit) { heads.push({p1: lastOut.point, p2: out.point}); } - const op = out.point, lp = lastOut.point, - moved = (op.x !== lp.x) || (op.y !== lp.y) || (op.z !== lp.z);; + const op = out.point, lp = lastOut.point; + // const moved = Math.max( + // Math.abs(op.x - lp.x), + // Math.abs(op.y - lp.y), + // Math.abs(op.z - lp.z)); + // if (moved < 0.0001) return; if (out.emit) { if (!lastOut.emit || (ckspeed && out.speed !== lastOut.speed) || lastEnd) { current = newPolygon().setOpen();