mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Do not keep iterating if the curve was reduced to a point.
This commit is contained in:
parent
d33d65fcc2
commit
3564dafa93
1 changed files with 2 additions and 2 deletions
|
@ -1152,7 +1152,7 @@ new function() { // Scope for methods that require numerical integration
|
||||||
curve1, t1, Curve.evaluate(v1, t1, 0),
|
curve1, t1, Curve.evaluate(v1, t1, 0),
|
||||||
curve2, t2, Curve.evaluate(v2, t2, 0));
|
curve2, t2, Curve.evaluate(v2, t2, 0));
|
||||||
}
|
}
|
||||||
} else { // Iterate
|
} else if (tDiff > 0) { // Iterate
|
||||||
addCurveIntersections(v2, v1, curve2, curve1, locations, include,
|
addCurveIntersections(v2, v1, curve2, curve1, locations, include,
|
||||||
uMin, uMax, tMinNew, tMaxNew, tDiff, !reverse, ++recursion);
|
uMin, uMax, tMinNew, tMaxNew, tDiff, !reverse, ++recursion);
|
||||||
}
|
}
|
||||||
|
@ -1190,7 +1190,7 @@ new function() { // Scope for methods that require numerical integration
|
||||||
var vx = l2x - l1x,
|
var vx = l2x - l1x,
|
||||||
vy = l2y - l1y;
|
vy = l2y - l1y;
|
||||||
if (Numerical.isZero(vx))
|
if (Numerical.isZero(vx))
|
||||||
return vy >= 0 ? l1x - x : x - l1x;
|
return vy >= 0 ? l1x - x : x - l1x;
|
||||||
var m = vy / vx, // slope
|
var m = vy / vx, // slope
|
||||||
b = l1y - m * l1x; // y offset
|
b = l1y - m * l1x; // y offset
|
||||||
// Distance to the linear equation
|
// Distance to the linear equation
|
||||||
|
|
Loading…
Reference in a new issue