1
0
Fork 0

Fixed offset issue when Cp lies on start/end

See https://github.com/Pomax/bezierjs/issues/37#issuecomment-410810976
This commit is contained in:
Joost De Cock 2018-08-06 20:43:19 +02:00
parent 4c81d41ab8
commit 8051a48880
2 changed files with 74 additions and 9 deletions

View file

@ -99,6 +99,12 @@ Point.prototype.shiftTowards = function(that, distance) {
return this.shift(this.angle(that), distance);
};
/** Checks whether this has the same coordinates as that */
Point.prototype.sitsOn = function(that) {
if (this.x === that.x && this.y === that.y) return true;
else return false;
};
/** Shifts this point fraction of the distance towards that point */
Point.prototype.shiftFractionTowards = function(that, fraction) {
return this.shiftTowards(that, this.dist(that) * fraction);