Compare intersection points instead of curve time when deciding to merge.

Use same precision indepenent of curve length.
This commit is contained in:
Jürg Lehni 2015-09-14 15:18:44 +02:00
parent fec479167c
commit 7aef20ae6b
2 changed files with 3 additions and 4 deletions

View file

@ -1662,6 +1662,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
if (pairs.length === 1 && pair[0] < pairs[0][0]) {
pairs.unshift(pair);
} else if (pairs.length === 0
// TODO: Compare distance of points instead!
|| abs(pair[0] - pairs[0][0]) > timeEpsilon
|| abs(pair[1] - pairs[0][1]) > timeEpsilon) {
pairs.push(pair);

View file

@ -284,10 +284,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|| loc instanceof CurveLocation
// Call getCurve() and getParameter() to keep in sync
&& this.getCurve() === loc.getCurve()
// Use the same tolerance for curve time parameter
// comparisons as in Curve.js
&& Math.abs(this.getParameter() - loc.getParameter())
< /*#=*/Numerical.CURVETIME_EPSILON
&& this.getPoint().isClose(loc.getPoint(),
/*#=*/Numerical.GEOMETRIC_EPSILON)
&& (_ignoreIntersection
|| (!this._intersection && !loc._intersection
|| this._intersection && this._intersection.equals(