aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/kugel/figures/tikz/legendre-substitution.tex
blob: 3a699b817ff3ef68486426d47c54a0d935141181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
% vim: ts=2 sw=2 et :
\documentclass[tikz, border=2mm]{standalone}

\usepackage{amsmath}
\usepackage{bm}

\usepackage{times}
\usepackage{txfonts}

\usepackage{tikz-3dplot}

\tdplotsetmaincoords{60}{130}
\pgfmathsetmacro{\l}{2}

\begin{document}
  \begin{tikzpicture}[
      >=latex,
      tdplot_main_coords,
    ]

    % origin and poles
    \coordinate (O) at (0,0,0);
    \coordinate (NP) at (0,0,\l);
    \coordinate (SP) at (0,0,-\l);

    % gray unit circle
    \tdplotdrawarc[lightgray, dashed]{(O)}{\l}{0}{360}{}{};
    \draw[lightgray, dashed] (-\l, 0, 0) to (\l, 0, 0);
    \draw[lightgray, dashed] (0, -\l, 0) to (0, \l, 0);

    % axis
    \draw[->] (O) -- ++(0,0,1.25*\l) node[above] {\(\mathbf{\hat{z}}\)};

    % meridians
    \foreach \phi in {0, 30, 60, ..., 150}{
      \tdplotsetrotatedcoords{\phi}{90}{0};
      \tdplotdrawarc[lightgray, densely dotted, tdplot_rotated_coords]{(O)}{\l}{0}{360}{}{};
    }

    % dot above and its projection
    \pgfmathsetmacro{\phi}{120}
    \pgfmathsetmacro{\theta}{40}

    \pgfmathsetmacro{\px}{cos(\phi)*sin(\theta)*\l}
    \pgfmathsetmacro{\py}{sin(\phi)*sin(\theta)*\l}
    \pgfmathsetmacro{\pz}{cos(\theta)*\l})

    % Special meridian
    \tdplotsetrotatedcoords{\phi-90}{90}{0};
    \tdplotdrawarc[gray, tdplot_rotated_coords]{(O)}{\l}{0}{360}{}{};
    
    % point A
    \coordinate (A) at (\px,\py,\pz);
    \coordinate (Ap) at (\px,\py, 0);
    
    % lines
    \draw[red!80!black, thick, ->] (O) -- (A);
    \draw[red!80!black]
      (O) -- node[midway, below, font=\small, sloped, fill=white] {$\sqrt{1 - z^2}$}
      (Ap) -- node[midway, right, font=\small, sloped, fill=white, anchor=north] {$z = \cos \vartheta$}
      (A) node[above right, fill=white] {$r = 1$};
    
    % theta arc
    \tdplotsetrotatedcoords{\phi-90}{-90}{0};
    \tdplotdrawarc[blue!80!black, ->, tdplot_rotated_coords]{(O)}{.95\l}{0}{\theta}{}{};
    \node[above right = 1mm, blue!80!black] at (0,0,.8\l) {\(\bm{\hat{\vartheta}}\)};
  \end{tikzpicture}
\end{document}