Since we're using sorting now, we can add all start- / end-point intersections before finding the ones within the curves.

This commit is contained in:
Jürg Lehni 2015-10-03 10:38:45 -05:00
parent 7496a7c9e2
commit 2167e458ae

View file

@ -1868,12 +1868,16 @@ new function() { // Scope for intersection using bezier fat-line clipping
// NOTE: Use smaller Numerical.EPSILON to compare beginnings and
// end points to avoid matching them on almost collinear lines.
epsilon = /*#=*/Numerical.EPSILON;
// Handle the special case where the first curve's stat-point
// overlaps with the second curve's start- or end-points.
// Handle the special case where the first curve's start- or end-
// point overlap with the second curve's start- or end-point.
if (c1p1.isClose(c2p1, epsilon))
addLocation(locations, param, v1, c1, 0, c1p1, v2, c2, 0, c2p1);
if (!param.startConnected && c1p1.isClose(c2p2, epsilon))
addLocation(locations, param, v1, c1, 0, c1p1, v2, c2, 1, c2p2);
if (!param.endConnected && c1p2.isClose(c2p1, epsilon))
addLocation(locations, param, v1, c1, 1, c1p2, v2, c2, 0, c2p1);
if (c1p2.isClose(c2p2, epsilon))
addLocation(locations, param, v1, c1, 1, c1p2, v2, c2, 1, c2p2);
// Determine the correct intersection method based on whether one or
// curves are straight lines:
(straight1 && straight2
@ -1886,12 +1890,6 @@ new function() { // Scope for intersection using bezier fat-line clipping
// addCurveIntersections():
// tMin, tMax, uMin, uMax, oldTDiff, reverse, recursion
0, 1, 0, 1, 0, false, 0);
// Handle the special case where the first curve's end-point
// overlaps with the second curve's start- or end-points.
if (!param.endConnected && c1p2.isClose(c2p1, epsilon))
addLocation(locations, param, v1, c1, 1, c1p2, v2, c2, 0, c2p1);
if (c1p2.isClose(c2p2, epsilon))
addLocation(locations, param, v1, c1, 1, c1p2, v2, c2, 1, c2p2);
return locations;
}
}};