When TikZ/PGF updated to version 3.0.0, the parameters of the PGFmath function atan2
where swapped. Up to version 2.10 it was
atan2(x, y)
It now is
atan2(y, x)
Think what you may of this change, however, it breaks backward compatibility, as you need to swap arguments in the linked code as well.
For my own libraries and purposes I created two substitute functions atanXY
and atanYX
\csname pgfmathatan2@\endcsname{0}{1}
\ifdim\pgfmathresult pt=0pt % atan2(y, x)
\pgfmathdeclarefunction{atanXY}{2}{\csname pgfmathatan2@\endcsname{#2}{#1}}
\pgfmathdeclarefunction{atanYX}{2}{\csname pgfmathatan2@\endcsname{#1}{#2}}
\else % atan2(x, y)
\pgfmathdeclarefunction{atanXY}{2}{\csname pgfmathatan2@\endcsname{#1}{#2}}
\pgfmathdeclarefunction{atanYX}{2}{\csname pgfmathatan2@\endcsname{#2}{#1}}
\fi
which was even more important when switching between the 2.10 and the CVS version.
Nowadays
\pgfmathdeclarefunction{atanXY}{2}{\pgfmathatantwo@{#2}{#1}}
\pgfmathdeclarefunction{atanYX}{2}{\pgfmathatantwo@{#1}{#2}}
should be enough.
This also allows it again to use atanXY(\p{<name>})
after one has used calc’s
let \p{<name>}=(<coordinates>) … in
path operator.
The \p{<name>}
macro just expands to \x{<name>},\y{<name>}
which is usually used inside TikZ coordinate specifications.
atan2
function?atan2(\x1,\y1)
becomesatan2(\y1, \x1)
and so on.tax nodes
? Something to do with the IRS?