From 89d9acf06eacd0f9d810d076e6a06ef9610a7454 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Sat, 20 Jan 2018 20:37:08 -0700 Subject: [PATCH] Line.intersect(Line): fix a "miss some intersections" bug Negative numbers are allowed in the denominator, what we really want to avoid is near-zero denominators. --- svgpathtools/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svgpathtools/path.py b/svgpathtools/path.py index f5fc806..b2c4fec 100644 --- a/svgpathtools/path.py +++ b/svgpathtools/path.py @@ -572,7 +572,7 @@ class Line(object): d = (other_seg.start.imag, other_seg.end.imag) denom = ((a[1] - a[0])*(d[0] - d[1]) - (b[1] - b[0])*(c[0] - c[1])) - if denom < 1e-9: + if abs(denom) < 1e-9: return [] t1 = (c[0]*(b[0] - d[1]) - c[1]*(b[0] - d[0]) -