\pgfintersectionofpaths
yields an error when the lines it is trying to intersect are almost parallel. This bug was discovered by users of package forest
and attributed to PGF, see TeX.SE question http://tex.stackexchange.com/questions/204094/sn-edges-and-nice-empty-nodes-styles-in-forest-lead-to-dividing-by-zero-whats.
This is an example of code that produces the error.
\pgfintersectionofpaths{% \pgfpathmoveto{\pgfpoint{0.0pt}{-3.53297pt}} \pgfpathlineto{\pgfpoint{19.54204pt}{-31.44316pt}}% }{% \pgfpathmoveto{\pgfpoint{34.6372pt}{-53.00208pt}}% \pgfpathlineto{\pgfpoint{19.54204pt}{-31.44316pt}}}
The error produced is
! Package PGF Math Error: You asked me to calculate 1/0.0', but I cannot divide any number by zero.
The "call stack" is (\pgfintersectionofpaths
, \pgfpointintersectionoflines
, \pgftransforminvert
): so the error occurs during \pgftransforminvert
, just as the documentation of this macro claims would happen if the matrix its trying to invert is near-singular.
Prior to calling \pgfpointintersectionoflines
to actually compute the intesection of lines, \pgf@intersectionoflines
(indirectly called by \pgfintersectionofpaths
) tries to figure out whether the lines intersect at all, and the problem seems to be in this part of the code, namely macro \pgf@iflinesintersect
, which apparently reports the lines to intersect, although computing the intersection later yields an error.
The expected behaviour would be for \pgfpointintersectionoflines
and \pgfiflinesintersect
to be consistent.
\pgfintersectionofpaths
yields an error when the lines are almost parallelDiff: