From 5e01774c91b177e5e5c06289427e43a955387df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 7 Jan 2016 13:09:47 +0100 Subject: [PATCH] Further simplify checks of crossing vs touching in getWinding() Relates to #890 --- src/path/PathItem.Boolean.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index c20e5f85..ae32f3bd 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -402,17 +402,13 @@ PathItem.inject(new function() { || t < tMin && prevT > tMax)) { var x = Curve.getPoint(values, t).x, counted = false; - // Take care of cases where the curve and the - // preceding curve merely touches the ray towards - // +-x direction, but proceeds to the same side of - // the ray. This essentially is not a crossing. - if (Numerical.isZero(Curve.getTangent(values, t).y) - && !Curve.isStraight(values) - // Does the winding over the edges change? - || t < tMin && prevCurve - && winding * prevCurve.winding < 0 - || t > tMax && nextCurve - && winding * nextCurve.winding < 0) { + // Take care of cases where the ray merely touches + // the connecting point between two neighboring mono + // curves, but does not cross either of them. + if (t < tMin && prevCurve + && winding * prevCurve.winding < 0 + || t > tMax && nextCurve + && winding * nextCurve.winding < 0) { if (x > xBefore && x < xAfter) { ++windLeft; ++windRight;