Skip to content

Commit

Permalink
Since we're using sorting now, we can add all start- / end-point inte…
Browse files Browse the repository at this point in the history
…rsections before finding the ones within the curves.
  • Loading branch information
lehni committed Oct 3, 2015
1 parent 7496a7c commit 2167e45
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/path/Curve.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
}};
Expand Down

0 comments on commit 2167e45

Please sign in to comment.