From 5d7a5960266797dc3fa6e1a393aa2555e17c6dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 3 Oct 2015 11:44:43 -0500 Subject: [PATCH] Fix wrong upper bounds check in Line.intersect() 1 as a solution was accidentally excluded. --- src/basic/Line.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/basic/Line.js b/src/basic/Line.js index 73fbf1b8..1ea3108d 100644 --- a/src/basic/Line.js +++ b/src/basic/Line.js @@ -138,14 +138,15 @@ var Line = Base.extend(/** @lends Line# */{ // Check the ranges of the u parameters if the line is not // allowed to extend beyond the definition points, but // compare with EPSILON tolerance over the [0, 1] bounds. - uMin = -/*#=*/Numerical.EPSILON, - uMax = 1 + uMin; + epsilon = /*#=*/Numerical.EPSILON, + uMin = -epsilon, + uMax = 1 + epsilon; if (isInfinite || uMin < u1 && u1 < uMax && uMin < u2 && u2 < uMax) { if (!isInfinite) { // Address the tolerance at the bounds by clipping to // the actual range. - u1 = u1 < 0 ? 0 : u1 > 1 ? 1 : u1; + u1 = u1 <= 0 ? 0 : u1 >= 1 ? 1 : u1; } return new Point( p1x + u1 * v1x,