Fix wrong upper bounds check in Line.intersect()

1 as a solution was accidentally excluded.
This commit is contained in:
Jürg Lehni 2015-10-03 11:44:43 -05:00
parent 61fc75ace3
commit 5d7a596026

View file

@ -138,14 +138,15 @@ var Line = Base.extend(/** @lends Line# */{
// Check the ranges of the u parameters if the line is not // Check the ranges of the u parameters if the line is not
// allowed to extend beyond the definition points, but // allowed to extend beyond the definition points, but
// compare with EPSILON tolerance over the [0, 1] bounds. // compare with EPSILON tolerance over the [0, 1] bounds.
uMin = -/*#=*/Numerical.EPSILON, epsilon = /*#=*/Numerical.EPSILON,
uMax = 1 + uMin; uMin = -epsilon,
uMax = 1 + epsilon;
if (isInfinite if (isInfinite
|| uMin < u1 && u1 < uMax && uMin < u2 && u2 < uMax) { || uMin < u1 && u1 < uMax && uMin < u2 && u2 < uMax) {
if (!isInfinite) { if (!isInfinite) {
// Address the tolerance at the bounds by clipping to // Address the tolerance at the bounds by clipping to
// the actual range. // the actual range.
u1 = u1 < 0 ? 0 : u1 > 1 ? 1 : u1; u1 = u1 <= 0 ? 0 : u1 >= 1 ? 1 : u1;
} }
return new Point( return new Point(
p1x + u1 * v1x, p1x + u1 * v1x,