mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Further simplify checks of crossing vs touching in getWinding()
Relates to #890
This commit is contained in:
parent
231dba83b2
commit
5e01774c91
1 changed files with 7 additions and 11 deletions
|
@ -402,17 +402,13 @@ PathItem.inject(new function() {
|
||||||
|| t < tMin && prevT > tMax)) {
|
|| t < tMin && prevT > tMax)) {
|
||||||
var x = Curve.getPoint(values, t).x,
|
var x = Curve.getPoint(values, t).x,
|
||||||
counted = false;
|
counted = false;
|
||||||
// Take care of cases where the curve and the
|
// Take care of cases where the ray merely touches
|
||||||
// preceding curve merely touches the ray towards
|
// the connecting point between two neighboring mono
|
||||||
// +-x direction, but proceeds to the same side of
|
// curves, but does not cross either of them.
|
||||||
// the ray. This essentially is not a crossing.
|
if (t < tMin && prevCurve
|
||||||
if (Numerical.isZero(Curve.getTangent(values, t).y)
|
&& winding * prevCurve.winding < 0
|
||||||
&& !Curve.isStraight(values)
|
|| t > tMax && nextCurve
|
||||||
// Does the winding over the edges change?
|
&& winding * nextCurve.winding < 0) {
|
||||||
|| t < tMin && prevCurve
|
|
||||||
&& winding * prevCurve.winding < 0
|
|
||||||
|| t > tMax && nextCurve
|
|
||||||
&& winding * nextCurve.winding < 0) {
|
|
||||||
if (x > xBefore && x < xAfter) {
|
if (x > xBefore && x < xAfter) {
|
||||||
++windLeft;
|
++windLeft;
|
||||||
++windRight;
|
++windRight;
|
||||||
|
|
Loading…
Reference in a new issue