new approach to extreme miter points

This commit is contained in:
Stewart Allen 2020-12-19 23:24:03 -05:00
commit 8cb0f37b26
3 changed files with 24 additions and 3 deletions

View file

@ -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;