Handle horizontal lines properly in Line.getSignedDistance()

Closes #546.
This commit is contained in:
Jürg Lehni 2014-11-08 17:26:13 -08:00
parent ebdc63fbfa
commit 4ab6446e16

View file

@ -166,7 +166,8 @@ var Line = Base.extend(/** @lends Line# */{
vx -= px;
vy -= py;
}
// Cache these values since they're used heavily in fatline code
if (Numerical.isZero(vx))
return x - px;
var m = vy / vx, // slope
b = py - m * px; // y offset
// Distance to the linear equation