aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/punktgruppen/tikz/stereographic-projections.tex
blob: 7d612fba2e9b41208aca8905716a5ef18b09e6e4 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{times}
\usepackage{txfonts}
\usepackage{tikz-3dplot}

\usetikzlibrary{arrows}
\usetikzlibrary{intersections}
\usetikzlibrary{math}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{calc}

\begin{document}

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

\begin{tikzpicture}[
    >=latex,
    tdplot_main_coords,
    dot/.style = {
      black, fill = black, circle,
      outer sep = 0, inner sep = 0,
      minimum size = 1mm 
    },
    round/.style = {
      draw = orange, thick, circle,
      minimum size = 1mm,
      inner sep = 0pt, outer sep = 0pt,
    },
    cross/.style = {
      cross out, draw = magenta, thick,
      minimum size = 1mm, 
      inner sep = 0pt, outer sep = 0pt
    },
  ]

  % origin
  \coordinate (O) at (0,0,0);

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

  % axis
  % \draw[->] (O) -- ++(1.5*\l,0,0);
  % \draw[->] (O) -- ++(0,1.5*\l,0);
  % \draw[->] (O) -- ++(0,0,1.5*\l);

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

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

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

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

  \coordinate (A) at (\px,\py,\pz);
  \coordinate (Aproj) at ({\px * \l / (\l + \pz)}, {\py * \l / (\l + \pz)}, 0);

  % dot below and its projection
  \pgfmathsetmacro{\phi}{-60}
  \pgfmathsetmacro{\theta}{120}

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

  \coordinate (B) at (\px,\py,\pz);
  \coordinate (Bproj) at ({\px * \l / (\l - \pz)}, {\py * \l / (\l - \pz)}, 0);

  % projection lines
  \draw[gray] (A) to (SP);
  \draw[gray] (SP) to (O) to (Aproj);

  \draw[gray] (B) to (NP);
  \draw[gray] (NP) to (O) to (Bproj);

  % dots
  \draw (O) node[dot] {};
  \draw (SP) node[dot] {};
  \draw (NP) node[dot] {};
  \draw (A) node[dot, fill = magenta, minimum size = 1.5mm] {};
  \draw (B) node[dot, fill = orange, minimum size = 1.5mm] {};

  % projection markers
  \draw[very thick, magenta] 
    (Aproj) ++(.15,0) to ($(Aproj)+(-.15, 0)$)
    (Aproj) ++(0,.15) to ($(Aproj) +(0, -.15)$);

  \tdplotdrawarc[orange, very thick]{(Bproj)}{.1}{0}{360}{}{};

\end{tikzpicture}
\end{document}
% vim:ts=2 sw=2 et: