[Tex/LaTex] tikz-3dplot rotation around the x-axis

3dtikz-3dplottikz-pgf

I'm trying to create a simple spherical quadrant grid using the tikz-3dplot package. The longitudinal grid lines look fine but when I try to create the latitudinal lines I get really strange results that I don't understand. I was expecting to see a series of latitude arcs rotating around the x-axis (so they're not quite the same as latitude lines). Instead, it appears that my attempt to rotate around the x-axis is rotating around all three axes. I'm not sure what I'm doing wrong.

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}

\begin{document}
\tdplotsetmaincoords{60}{155}
\usetikzlibrary{3d}

\begin{tikzpicture}[scale=5,tdplot_main_coords]
\tikzstyle{grid}=[thin,color=red,tdplot_rotated_coords]

\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (-1,0,0);
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

\foreach \rot in {0, 30, 60, 90} {
    \tdplotsetrotatedcoords{\rot}{0}{0};
    \tdplotdrawarc[grid]{(0,0,0)}{1}{0}{180}{}{};
}

\foreach \rot in {-90, -60, -30, 0, 30, 60, 90} {
    \tdplotsetrotatedcoords{\rot}{90}{0};
    \tdplotdrawarc[grid]{(0,0,0)}{1}{90}{180}{}{};
}

\end{tikzpicture}
\end{document}

Results shown in QTikz

Edit:

After more investigation it appears that attempting to rotate around the x-axis actually rotates around the z-axis, as can be clearly seen in this image. Placing the \rot in the x- or z-position has the same effect.

Image with only x rotated and shortened arcs.

Best Answer

Actually,this is not a bug. The rotations are not xyz rotations but rather zyz rotations. To make a 90 degree rotation around the x-axis you can make a 90 degree rotation around the z-axis, followed by a 90 degree rotation around the rotated y-axis, and finaly a 270 degree rotation around the rotated z-axis. These rotations are called Euler rotations. You can read more about Euler rotations on Wikipedia or tikz-3dplot documention.