%Angle Definitions %----------------- %set the plot display orientation %syntax: \tdplotsetdisplay{\theta_d}{\phi_d} \tdplotsetmaincoords{60}{25} %define polar coordinates for some vector %TODO: look into using 3d spherical coordinate system \pgfmathsetmacro{\rvec}{1} \pgfmathsetmacro{\thetavec}{50} \pgfmathsetmacro{\phivec}{15} %start tikz picture, and use the tdplot_main_coords style to implement the display \begin{tikzpicture}[scale=5,tdplot_main_coords] %set up some coordinates %----------------------- \coordinate (O) at (0,0,0); \fill (O) circle[radius=0.4pt] node[below left] {O}; %determine a coordinate (P) using (r,\theta,\phi) coordinates. %syntax: \tdplotsetcoord{Coordinate name without parentheses}{r}{\theta}{\phi} \tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec} \fill (P) circle[radius=0.4pt] node[anchor=south west] {$\mathbf v$}; %draw figure contents %-------------------- %draw the main coordinate system axes \draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$}; \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$}; %draw a vector from origin to point (P), projection on xy plane, and a connecting line \draw[-stealth,color=red] (O) -- (P); \draw[dashed, color=red] (O) -- (Pxy); \draw[dashed, color=red] (P) -- (Pxy); %draw the angle \phi, and label it %syntax: \tdplotdrawarc[coordinate frame, draw options]{center point}{r}{angle start}{angle end}{label options}{label} \tdplotdrawarc{(O)}{0.2}{0}{\phivec}{anchor=north}{$\phi$} %set the rotated coord system so the x'y' plane coincides with the"theta plane" of the main coord system %syntax: \tdplotsetthetaplanecoords{\phi} \tdplotsetthetaplanecoords{\phivec} %draw theta arc and label, using rotated coordinate system \tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.2}{0}{\thetavec}{anchor=south west}{$\theta$} %draw some dashed arcs, demonstrating direct arc drawing \draw[dashed,tdplot_rotated_coords] (\rvec,0,0) arc (0:90:\rvec); \draw[dashed] (\rvec,0,0) arc (0:90:\rvec); \end{tikzpicture}