User Tools

Site Tools


latex:example_spherical_coordinates

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
latex:example_spherical_coordinates [2017/06/07 20:29] – created iwnlatex:example_spherical_coordinates [2021/09/29 12:38] (current) iwn
Line 1: Line 1:
 +<WRAP group><WRAP half column 35%>
 +{{ latex: spherical_coordinates.png ? 0x1000 }}
 +</WRAP><WRAP half column 60%>
 +\\
 +{{ latex:cms_coordinate_system.png ? 0x1000 }}
 +</WRAP></WRAP>
  
-<file latex spherical_coordinates.tex>+Simple example of 3D axes with spherical coordinates. 
 +You can find more diagrams of coordinate systems [[https://tikz.net/axis3d/|here]], and [[https://tikz.net/axis3d_cms/|here]] for the CMS conventional coordinate system. More figures related to Particle Physics can be found at https://tikz.net/category/physics/particle-physics/
 + 
 +<file latex axes3D.tex>
 % Author: Izaak Neutelings (June 2017) % Author: Izaak Neutelings (June 2017)
 % taken from https://tex.stackexchange.com/questions/159445/draw-in-cylindrical-and-spherical-coordinates % taken from https://tex.stackexchange.com/questions/159445/draw-in-cylindrical-and-spherical-coordinates
Line 16: Line 25:
 \begin{document} \begin{document}
  
 +
 +
 +% 3D axis with spherical coordinates
 \tdplotsetmaincoords{60}{110} \tdplotsetmaincoords{60}{110}
 \begin{tikzpicture}[scale=3,tdplot_main_coords] \begin{tikzpicture}[scale=3,tdplot_main_coords]
Line 24: Line 36:
   \def\phivec{60}   \def\phivec{60}
      
-  % axes & vector+  % axes
   \coordinate (O) at (0,0,0);   \coordinate (O) at (0,0,0);
   \draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};   \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,1,0) node[anchor=north west]{$y$};
   \draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};   \draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
 +  
 +  % vectors
   \tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}   \tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}
-    \draw[-stealth,color=red] (O) -- (P) node[above right] {$P$};+  \draw[-stealth,red] (O)  -- (P) node[above right] {$P$}
 +  \draw[dashed,red]   (O)  -- (Pxy); 
 +  \draw[dashed,red]   (P)  -- (Pxy); 
 +  \draw[dashed,red]   (Py) -- (Pxy);
      
   % arcs   % arcs
-  \draw[dashed, color=red] (O) -- (Pxy); 
-  \draw[dashed, color=red] (P) -- (Pxy); 
   \tdplotdrawarc[->]{(O)}{0.2}{0}{\phivec}   \tdplotdrawarc[->]{(O)}{0.2}{0}{\phivec}
     {anchor=north}{$\phi$}     {anchor=north}{$\phi$}
Line 42: Line 57:
  
 \end{tikzpicture} \end{tikzpicture}
 +
 +
 +
 +% CMS conventional coordinate system with LHC and other detectors
 +\tdplotsetmaincoords{75}{50} % to reset previous setting
 +\begin{tikzpicture}[scale=2.7,tdplot_main_coords,rotate around x=90]
 +  
 +  % variables
 +  \def\rvec{1.2}
 +  \def\thetavec{40}
 +  \def\phivec{70}
 +  \def\R{1.1}
 +  \def\w{0.3}
 +  
 +  % axes
 +  \coordinate (O) at (0,0,0);
 +  \draw[thick,->] (0,0,0) -- (1,0,0) node[below left]{$x$};
 +  \draw[thick,->] (0,0,0) -- (0,1,0) node[below right]{$y$};
 +  \draw[thick,->] (0,0,0) -- (0,0,1) node[below right]{$z$};
 +  \tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}
 +  
 +  % vectors
 +  \draw[->,red] (O) -- (P) node[above left] {$P$};
 +  \draw[dashed,red] (O)  -- (Pxy);
 +  \draw[dashed,red] (P)  -- (Pxy);
 +  \draw[dashed,red] (Py) -- (Pxy);
 +  
 +  % circle - LHC
 +  \tdplotdrawarc[thick,rotate around x=90,black!70!blue]{(\R,0,0)}{\R}{0}{360}{}{}
 +  
 +  % compass - the line between CMS and ATLAS has a ~12° declination (http://googlecompass.com)
 +  \begin{scope}[shift={(1.1*\R,0,1.65*\R)},rotate around y=12]
 +    \draw[<->,black!50] (-\w,0,0) -- (\w,0,0);
 +    \draw[<->,black!50] (0,0,-\w) -- (0,0,\w);
 +    \node[above left,black!50,scale=0.6] at (-\w,0,0) {N};
 +  \end{scope}
 +
 +  % nodes
 +  \node[left,align=center] at (0,0,1.1) {Jura};
 +  \node[right] at (\R,0,0) {LHC};
 +  \fill[radius=0.8pt,black!20!red]
 +    (O) circle node[left=4pt,below=2pt] {CMS};
 +  \draw[thick] (0.02,0,0) -- (0.5,0,0); % partially overdraw x-axis and CMS point
 +  \fill[radius=0.8pt,black!20!blue]
 +    (2*\R,0,0) circle
 +    node[right=4pt,below=2pt,scale=0.9] {ATLAS};
 +  \fill[radius=0.8pt,black!10!orange]
 +    ({\R*sqrt(2)/2+\R},0,{ \R*sqrt(2)/2}) circle
 +    node[left=2pt,below=2pt,scale=0.8] {ALICE};
 +  \fill[radius=0.8pt,black!60!green]
 +    ({\R*sqrt(2)/2+\R},0,{-\R*sqrt(2)/2}) circle
 +    node[below=2pt,right=2pt,scale=0.8] {LHCb};
 +  
 +  % arcs
 +  \tdplotdrawarc[->]{(O)}{0.2}{0}{\phivec}
 +    {above=2pt,right=-1pt,anchor=mid west}{$\phi$}
 +  \tdplotdrawarc[->,rotate around z=\phivec-90,rotate around y=-90]{(0,0,0)}{0.5}{0}{\thetavec}
 +    {anchor=mid east}{$\theta$}
 +
 +\end{tikzpicture}
 +
 +
  
 \end{document} \end{document}
 </file> </file>
latex/example_spherical_coordinates.1496860173.txt.gz · Last modified: 2017/06/07 20:29 by iwn