Perform bounding box checkes with GEOMETRIC_EPSILON

Closes #878
This commit is contained in:
Jürg Lehni 2015-12-31 10:21:38 +01:00
parent d7cd016d9e
commit f8791f2be5

View file

@ -1685,7 +1685,8 @@ new function() { // Scope for intersection using bezier fat-line clipping
// a little optimization, we can scale the handles with 0.75
// before calculating the control bounds and still be sure that
// the curve is fully contained.
var c1p1x = v1[0], c1p1y = v1[1],
var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON,
c1p1x = v1[0], c1p1y = v1[1],
c1p2x = v1[6], c1p2y = v1[7],
c2p1x = v2[0], c2p1y = v2[1],
c2p2x = v2[6], c2p2y = v2[7],
@ -1700,13 +1701,13 @@ new function() { // Scope for intersection using bezier fat-line clipping
c2s2y = (3 * v2[5] + c2p2y) / 4,
min = Math.min,
max = Math.max;
if (!( max(c1p1x, c1s1x, c1s2x, c1p2x) >=
if (!( max(c1p1x, c1s1x, c1s2x, c1p2x) + epsilon >=
min(c2p1x, c2s1x, c2s2x, c2p2x) &&
min(c1p1x, c1s1x, c1s2x, c1p2x) <=
min(c1p1x, c1s1x, c1s2x, c1p2x) - epsilon <=
max(c2p1x, c2s1x, c2s2x, c2p2x) &&
max(c1p1y, c1s1y, c1s2y, c1p2y) >=
max(c1p1y, c1s1y, c1s2y, c1p2y) + epsilon >=
min(c2p1y, c2s1y, c2s2y, c2p2y) &&
min(c1p1y, c1s1y, c1s2y, c1p2y) <=
min(c1p1y, c1s1y, c1s2y, c1p2y) - epsilon <=
max(c2p1y, c2s1y, c2s2y, c2p2y)))
return locations;
// Now detect and handle overlaps: