mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
parent
bbcfa644d9
commit
0e8b304715
1 changed files with 26 additions and 28 deletions
|
@ -533,38 +533,36 @@ PathItem.inject(new function() {
|
||||||
windingR += winding;
|
windingR += winding;
|
||||||
onPath = true;
|
onPath = true;
|
||||||
}
|
}
|
||||||
} else if (winding !== windingPrev) {
|
// Determine the quality of the winding calculation. Reduce the
|
||||||
// Curve is crossed at starting point and winding changes from
|
// quality with every crossing of the ray very close to the
|
||||||
// previous curve. Cancel the winding from previous curve.
|
// path. This means that if the point is on or near multiple
|
||||||
if (a3Prev < paR) {
|
// curves, the quality becomes less than 0.5.
|
||||||
windingL += winding;
|
|
||||||
}
|
|
||||||
if (a3Prev > paL) {
|
|
||||||
windingR += winding;
|
|
||||||
}
|
|
||||||
} else if (a3Prev < paL && a > paL || a3Prev > paR && a < paR) {
|
|
||||||
// Point is on a horizontal curve between the previous non-
|
|
||||||
// horizontal and the current curve.
|
|
||||||
onPath = true;
|
|
||||||
if (a3Prev < paL) {
|
|
||||||
// left winding was added before, now add right winding.
|
|
||||||
windingR += winding;
|
|
||||||
} else if (a3Prev > paR) {
|
|
||||||
// right winding was added before, now add left winding.
|
|
||||||
windingL += winding;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Determine the quality of the winding calculation. Currently the
|
|
||||||
// quality is reduced with every crossing of the ray very close
|
|
||||||
// to the path. This means that if the point is on or near multiple
|
|
||||||
// curves, the quality becomes less than 0.5
|
|
||||||
// TODO: Set quality depending on distance
|
|
||||||
if (po !== o0) {
|
|
||||||
if (a > pa - qualityEpsilon && a < pa + qualityEpsilon) {
|
if (a > pa - qualityEpsilon && a < pa + qualityEpsilon) {
|
||||||
//quality *= Math.min(1, (100 * epsilon * Math.abs(a - pa) + 0.5));
|
// TODO: Set quality depending on distance
|
||||||
|
// quality *= Math.min(1, (100 * epsilon * Math.abs(a - pa) + 0.5));
|
||||||
quality /= 2;
|
quality /= 2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (winding !== windingPrev) {
|
||||||
|
// Curve is crossed at starting point and winding changes
|
||||||
|
// from previous curve. Cancel winding from previous curve.
|
||||||
|
if (a3Prev < paR) {
|
||||||
|
windingL += winding;
|
||||||
|
} else if (a3Prev > paL) {
|
||||||
|
windingR += winding;
|
||||||
|
}
|
||||||
|
} else if (a3Prev < paL && a > paL || a3Prev > paR && a < paR) {
|
||||||
|
// Point is on a horizontal curve between the previous non-
|
||||||
|
// horizontal and the current curve.
|
||||||
|
if (a3Prev < paL) {
|
||||||
|
// Left winding was added before, now add right winding.
|
||||||
|
windingR += winding;
|
||||||
|
} else if (a3Prev > paR) {
|
||||||
|
// Right winding was added before, now add left winding.
|
||||||
|
windingL += winding;
|
||||||
|
}
|
||||||
|
onPath = true;
|
||||||
|
}
|
||||||
// TODO:
|
// TODO:
|
||||||
quality = 0;
|
quality = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue