mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Small but critical fix on getSignedDistance method
when the line is perfectly vertical, return the difference between x values depending on the side. The earlier "l1y" is a silly mistake.
This commit is contained in:
parent
4371e92191
commit
3781aedb22
1 changed files with 1 additions and 1 deletions
|
@ -1192,7 +1192,7 @@ new function() { // Scope for methods that require numerical integration
|
||||||
var vx = l2x - l1x,
|
var vx = l2x - l1x,
|
||||||
vy = l2y - l1y;
|
vy = l2y - l1y;
|
||||||
if (Numerical.isZero(vx))
|
if (Numerical.isZero(vx))
|
||||||
return vy >= 0 ? l1y - x : x - l1x;
|
return vy >= 0 ? l1x - x : x - l1x;
|
||||||
var m = vy / vx, // slope
|
var m = vy / vx, // slope
|
||||||
b = l1y - m * l1x; // y offset
|
b = l1y - m * l1x; // y offset
|
||||||
// Distance to the linear equation
|
// Distance to the linear equation
|
||||||
|
|
Loading…
Reference in a new issue