I have a problem when rendering the following code with MiKTeX (it renders fine with MacTeX). My arcs of longitude are not displaying correctly (pushed to the edges of the ball instead of towards the middle). I think the problem might be the PGF version I am using (3.0 on MiKTeX and 2.10 on MacTeX). Reading this post http://latex-community.org/forum/viewtopic.php?f=45&t=25293 it makes me wonder whether the problem is a bug in the PGF/TikZ version mention in this post, but it's been two years since this post. I've tried replacing .estyle by .style to no avail.
I have to get the code working with MiKTeX, is there any way to do that? I appreciate your advice!
\documentclass{article}
\usepackage{tikz}
\newcommand\pgfmathsinandcos[3]{%
\pgfmathsetmacro#1{sin(#3)}%
\pgfmathsetmacro#2{cos(#3)}%
}
\newcommand\LongitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % azimuth
\tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\DrawLongitudeCircle[2][1]{
\LongitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
% angle of "visibility"
\pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
\draw[color=blue,current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
\draw[color=blue,current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}
\begin{document}
\begin{tikzpicture}
\def\R{2} % sphere radius
\def\angEl{5} % elevation angle
\def\meridian{-100}
\fill[ball color=white!20] (0,0) circle (\R);
\DrawLongitudeCircle[\R]{\meridian}
\end{tikzpicture}
\end{document}