new approach to extreme miter points
This commit is contained in:
parent
065dd1d52b
commit
8cb0f37b26
3 changed files with 24 additions and 3 deletions
|
|
@ -287,7 +287,13 @@
|
|||
for (let i=0; i<pln; i++) {
|
||||
const p = pa[(i+pln) % pln];
|
||||
const d = ang[(i+pln) % pln];
|
||||
if (d > 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];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue