mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Remove handling of converged fat-line, as it causes issues.
Example 23 in #784 was caused by this, and the code's removal has not produced any new issues, while it solved 6 issues in @iconexperience's test suite. Closes #795
This commit is contained in:
parent
93cacffd06
commit
1f03b00f99
1 changed files with 25 additions and 33 deletions
|
@ -1450,13 +1450,6 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
dMax = factor * Math.max(0, d1, d2),
|
dMax = factor * Math.max(0, d1, d2),
|
||||||
tMinNew, tMaxNew,
|
tMinNew, tMaxNew,
|
||||||
tDiff;
|
tDiff;
|
||||||
if (q0x === q3x && uMax - uMin < epsilon && recursion >= 3) {
|
|
||||||
// The fat-line of Q has converged to a point, the clipping is not
|
|
||||||
// reliable. Return the value we have even though we will miss the
|
|
||||||
// precision.
|
|
||||||
tMaxNew = tMinNew = (tMax + tMin) / 2;
|
|
||||||
tDiff = 0;
|
|
||||||
} else {
|
|
||||||
// Calculate non-parametric bezier curve D(ti, di(t)) - di(t) is the
|
// Calculate non-parametric bezier curve D(ti, di(t)) - di(t) is the
|
||||||
// distance of P from the baseline l of the fat-line, ti is equally
|
// distance of P from the baseline l of the fat-line, ti is equally
|
||||||
// spaced in [0, 1]
|
// spaced in [0, 1]
|
||||||
|
@ -1478,11 +1471,10 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
||||||
// Clip P with the fat-line for Q
|
// Clip P with the fat-line for Q
|
||||||
v1 = Curve.getPart(v1, tMinClip, tMaxClip);
|
v1 = Curve.getPart(v1, tMinClip, tMaxClip);
|
||||||
tDiff = tMaxClip - tMinClip;
|
tDiff = tMaxClip - tMinClip;
|
||||||
// tMin and tMax are within the range (0, 1). We need to project it
|
// tMin and tMax are within the range (0, 1). We need to project it to
|
||||||
// to the original parameter range for v2.
|
// the original parameter range for v2.
|
||||||
tMinNew = tMax * tMinClip + tMin * (1 - tMinClip);
|
tMinNew = tMax * tMinClip + tMin * (1 - tMinClip);
|
||||||
tMaxNew = tMax * tMaxClip + tMin * (1 - tMaxClip);
|
tMaxNew = tMax * tMaxClip + tMin * (1 - tMaxClip);
|
||||||
}
|
|
||||||
// Check if we need to subdivide the curves
|
// Check if we need to subdivide the curves
|
||||||
if (oldTDiff > 0.5 && tDiff > 0.5) {
|
if (oldTDiff > 0.5 && tDiff > 0.5) {
|
||||||
// Subdivide the curve which has converged the least.
|
// Subdivide the curve which has converged the least.
|
||||||
|
|
Loading…
Reference in a new issue