How should the venndiagram package be used? Or how can I avoid weird results?
In venndiagram.sty on lines 138, 140, 147, 159, 151, 153, the arguments of atan2
are in the wrong order. When I reverse them, one gets the desired results. What I mean is that the original arguments to atan2 were entered as (dx,dy), but they should be entered as (dy,dx).
Corrected passage: (lines 128-164)
\def\fillOnlyA{%
\begin{scope}
\path[name path=A] (\@venn@Ax,\@venn@Ay) circle (\@venn@radius);
\path[name path=BC] (\@venn@Bx,\@venn@By) circle (\@venn@radius)
(\@venn@Cx,\@venn@Cy) circle (\@venn@radius);
\path[name intersections={of=A and BC,name=ABintersect}]
(ABintersect-1) ;
\pgfgetlastxy{\@venn@AB@xi}{\@venn@AB@yi}
\path (ABintersect-2);
\pgfgetlastxy{\@venn@AB@xii}{\@venn@AB@yii}
\pgfmathparse{atan2(\@venn@AB@yi-\@venn@Ay,\@venn@AB@xi-\@venn@Ax)}
\let\@venn@start@i=\pgfmathresult
\pgfmathparse{360+atan2(\@venn@AB@yii-\@venn@Ay,\@venn@AB@xii-\@venn@Ax)}
\let\@venn@end@i=\pgfmathresult
\path[name path=B] (\@venn@Bx,\@venn@By) circle (\@venn@radius);
\path[name path=C] (\@venn@Cx,\@venn@Cy) circle (\@venn@radius);
\path[name intersections={of=B and C,name=BCintersect}]
(BCintersect-1);
\pgfgetlastxy{\@venn@BC@x}{\@venn@BC@y}
\pgfmathparse{atan2(\@venn@AB@yii-\@venn@Cy,\@venn@AB@xii-\@venn@Cx )}
\let\@venn@start@ii=\pgfmathresult
\pgfmathparse{atan2(\@venn@BC@y-\@venn@Cy,\@venn@BC@x-\@venn@Cx )}
\let\@venn@end@ii=\pgfmathresult
\pgfmathparse{atan2(\@venn@BC@y-\@venn@By,\@venn@BC@x-\@venn@Bx )}
\let\@venn@start@iii=\pgfmathresult
\pgfmathparse{atan2(\@venn@AB@yi-\@venn@By,\@venn@AB@xi-\@venn@Bx )-360}
\let\@venn@end@iii=\pgfmathresult
\path[fill=\@venn@shade] (ABintersect-1)
arc[radius=\@venn@radius,
start angle=\@venn@start@i,end angle=\@venn@end@i]
arc[radius=\@venn@radius,
start angle=\@venn@start@ii,end angle=\@venn@end@ii]
arc[radius=\@venn@radius,
start angle=\@venn@start@iii,end angle=\@venn@end@iii]
-- cycle;
\end{scope}
}%
This is now fixed in venndiagram
v1.1 which checks \pgfversion
to determine what syntax to use for atan2
, so venndiagram
should now work with both pgf
v2.0 and pgf
v3.0.