mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
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:
parent
7496a7c9e2
commit
2167e458ae
1 changed files with 6 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
}};
|
||||
|
|
Loading…
Reference in a new issue