mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Merge the two convergence checks to one.
This commit is contained in:
parent
ec1ef905cf
commit
24f61c854a
1 changed files with 2 additions and 11 deletions
|
@ -141,23 +141,14 @@ function getCurveIntersections(v1, v2, curve1, curve2, locations,
|
|||
// Check if one of the parameter range has converged completely to a
|
||||
// point. Now things could get only worse if we iterate more for the
|
||||
// other curve to converge if it hasn't yet happened so.
|
||||
var span1 = Math.abs(range1[1] - range1[0]),
|
||||
span2 = Math.abs(range2[1] - range2[0]),
|
||||
converged1 = span1 < /*#=*/ Numerical.EPSILON,
|
||||
converged2 = span2 < /*#=*/ Numerical.EPSILON;
|
||||
var converged1 = Math.abs(range1[1] - range1[0]) < /*#=*/ Numerical.TOLERANCE,
|
||||
converged2 = Math.abs(range2[1] - range2[0]) < /*#=*/ Numerical.TOLERANCE;
|
||||
if (converged1 || converged2) {
|
||||
addLocation(locations, curve1, null, converged1
|
||||
? curve1.getPointAt(range1[0], true)
|
||||
: curve2.getPointAt(range2[0], true), curve2);
|
||||
break;
|
||||
}
|
||||
if (span1 <= /*#=*/ Numerical.TOLERANCE
|
||||
&& span2 <= /*#=*/ Numerical.TOLERANCE) {
|
||||
// Both parameter ranges have converged.
|
||||
addLocation(locations, curve1, range1[0],
|
||||
curve1.getPointAt(range1[0], true), curve2);
|
||||
break;
|
||||
}
|
||||
// see if either or both of the curves are flat enough to be treated
|
||||
// as lines.
|
||||
var flat1 = Curve.isFlatEnough(part1, /*#=*/ Numerical.TOLERANCE),
|
||||
|
|
Loading…
Reference in a new issue