diagrams / diagrams-lib

Diagrams standard library
https://diagrams.github.io/
Other
138 stars 62 forks source link

intersectPoints fails to find intersections #342

Open dpthurst opened 5 years ago

dpthurst commented 5 years ago

I have an examples where 'intersectPoints' unaccountably fails to find an intersection point that must exist by the Jordan Curve Theorem. I've attached an example with two explicit paths. bug.zip

Geometrically, this is a circle around a certain point and a horizontal path leading from the center to a point outside the circle. Apologies for the explicit coordinates, this is extracted from a hyperbolic geometry drawing. The issue seems to be sensitive to the size of the circle.

byorgey commented 5 years ago

Thanks for the report. I wonder if this is a similar issue to https://github.com/diagrams/diagrams-lib/issues/142 .

dpthurst commented 5 years ago

That does sound like a very similar issue, that was my guess as to what was happening. The intersection point algorithm needs to account for the line being continuous.

georgefst commented 4 years ago

I've hit this a few times myself, though mine perhaps looks less like an example of #142.

A runnable example, plus SVG output, can be found in this gist.