mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Merge pull request #612 from iconexperience/master
Improve Line.getSignedDistance()
This commit is contained in:
commit
d74d9274a1
1 changed files with 1 additions and 2 deletions
|
@ -169,8 +169,7 @@ var Line = Base.extend(/** @lends Line# */{
|
||||||
? vy >= 0 ? px - x : x - px
|
? vy >= 0 ? px - x : x - px
|
||||||
: Numerical.isZero(vy)
|
: Numerical.isZero(vy)
|
||||||
? vx >= 0 ? y - py : py - y
|
? vx >= 0 ? y - py : py - y
|
||||||
: -(vy * x - vx * y - px * (py + vy) + py * (px + vx)) /
|
: (vx * (y - py) - vy * (x - px)) / Math.sqrt(vx * vx + vy * vy);
|
||||||
Math.sqrt(vx * vx + vy * vy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue