| 1 |
\documentclass[tikz]{standalone} |
| 2 |
|
| 3 |
\usepackage{fontspec} |
| 4 |
\usepackage{mathtools} |
| 5 |
\usepackage{unicode-math} |
| 6 |
\usepackage{siunitx} |
| 7 |
|
| 8 |
\newcommand{\az}{\ensuremath{\Phi}} |
| 9 |
\newcommand{\el}{\ensuremath{\theta}} |
| 10 |
|
| 11 |
% Tikz Style |
| 12 |
\usepackage{tikz} |
| 13 |
|
| 14 |
\usetikzlibrary{decorations.markings} |
| 15 |
\usetikzlibrary{arrows.meta} |
| 16 |
|
| 17 |
\usepackage{pgfplots} |
| 18 |
\pgfplotsset{ |
| 19 |
compat=1.18 |
| 20 |
,width=15cm |
| 21 |
,lua debug |
| 22 |
} |
| 23 |
|
| 24 |
\definecolor{celestial}{rgb}{1,0,1}%{0.0, 0.51, 0.5} |
| 25 |
\definecolor{elevation}{rgb}{0,1,0}%{0.6, 0.4, 0.8} |
| 26 |
\definecolor{horizon}{rgb}{0,0,1}%{0.54, 0.81, 0.94} |
| 27 |
\definecolor{sun}{rgb}{0.83, 0.0, 0.25} |
| 28 |
|
| 29 |
\tikzstyle{help circle} = [dashed, thick] |
| 30 |
\tikzstyle{coordinate curve} = [ultra thick] |
| 31 |
\tikzstyle{sun position} = [color=sun,ultra thick] |
| 32 |
\tikzstyle{navi direction} = [font=\sffamily\Large] |
| 33 |
\tikzstyle{coordinate angle} = [font=\Large] |
| 34 |
\tikzstyle{base plane} = [font=\sffamily] |
| 35 |
|
| 36 |
\begin{document} |
| 37 |
\begin{tikzpicture} |
| 38 |
\begin{axis}[view={5}{5} |
| 39 |
,axis lines=none, |
| 40 |
,plot box ratio={1 1 1} |
| 41 |
,xlabel=$x$ |
| 42 |
,ylabel=$y$ |
| 43 |
,zlabel=$z$ |
| 44 |
,xmin=-1.4 |
| 45 |
,xmax=1.4 |
| 46 |
% ,ymin=-1.2 |
| 47 |
% ,ymax=1.2 |
| 48 |
% ,zmin=-1.2 |
| 49 |
% ,zmax=1.2 |
| 50 |
,declare function={ |
| 51 |
% Sun position |
| 52 |
azimuth=-110; % Positive = westward from north |
| 53 |
elevation = 65; % Positive = from Horizon to Zenith |
| 54 |
sunx = cos(azimuth)*cos(elevation); |
| 55 |
suny = sin(azimuth)*cos(elevation); |
| 56 |
sunz = sin(elevation); |
| 57 |
% Text Az coordinates |
| 58 |
textazx = cos(3/5*azimuth); |
| 59 |
textazy = sin(3/5*azimuth); |
| 60 |
textazz = 0; |
| 61 |
% Text El coordinates |
| 62 |
textelx = cos(azimuth)*cos(elevation/2); |
| 63 |
textely = sin(azimuth)*cos(elevation/2); |
| 64 |
textelz = sin(elevation/2); |
| 65 |
% Celestial Meridian |
| 66 |
ucx = 1; |
| 67 |
ucy = 0; |
| 68 |
ucz = 0; |
| 69 |
% |
| 70 |
vcx = 0; |
| 71 |
vcy = 0; |
| 72 |
vcz = 1; |
| 73 |
celestialx(\t) = cos(\t)*ucx + sin(\t)*vcx; |
| 74 |
celestialy(\t) = cos(\t)*ucy + sin(\t)*vcy; |
| 75 |
celestialz(\t) = cos(\t)*ucz + sin(\t)*vcz; |
| 76 |
% Horizon => Azimut |
| 77 |
uhx = 1; |
| 78 |
uhy = 0; |
| 79 |
uhz = 0; |
| 80 |
% |
| 81 |
vhx = 0; |
| 82 |
vhy = 1; |
| 83 |
vhz = 0; |
| 84 |
horizonx(\t) = cos(\t)*uhx + sin(\t)*vhx; |
| 85 |
horizony(\t) = cos(\t)*uhy + sin(\t)*vhy; |
| 86 |
horizonz(\t) = cos(\t)*uhz + sin(\t)*vhz; |
| 87 |
% Elevation |
| 88 |
uex = cos(azimuth); |
| 89 |
uey = sin(azimuth); |
| 90 |
uez = 0; |
| 91 |
% |
| 92 |
vex = 0; |
| 93 |
vey = 0; |
| 94 |
vez = 1; |
| 95 |
elevationx(\t) = cos(\t)*uex + sin(\t)*vex; |
| 96 |
elevationy(\t) = cos(\t)*uey + sin(\t)*vey; |
| 97 |
elevationz(\t) = cos(\t)*uez + sin(\t)*vez; |
| 98 |
} |
| 99 |
] |
| 100 |
% |
| 101 |
\draw[->] (0,0,0) -- (1.1,0,0) node[anchor=west,navi direction] {North}; |
| 102 |
\draw[->] (0,0,0) -- (0,-1.5,0) node[anchor=north,navi direction] {East}; |
| 103 |
\draw[->] (0,0,0) -- (0,0,1.1) node[anchor=south,navi direction] {Zenith}; |
| 104 |
\node at ( 0.71, 0,0.71)[anchor=west,outer sep=1ex,base plane] {Meridian}; %0.71 app sqrt(2)/2 |
| 105 |
\node at (-0.71, 0.71,0) [anchor=south,base plane] {Horizon}; |
| 106 |
% Plot the Meridian through Nord |
| 107 |
\addplot3 [ |
| 108 |
domain=0:360, |
| 109 |
samples=60, |
| 110 |
samples y=1, |
| 111 |
variable=t, |
| 112 |
celestial,help circle |
| 113 |
] ( |
| 114 |
{celestialx(t)}, |
| 115 |
{celestialy(t)}, |
| 116 |
{celestialz(t)} |
| 117 |
); |
| 118 |
% Plot the horizon circle |
| 119 |
\addplot3 [ |
| 120 |
domain=0:360, |
| 121 |
samples=60, |
| 122 |
samples y=1, |
| 123 |
variable=t, |
| 124 |
horizon,help circle |
| 125 |
] ( |
| 126 |
{horizonx(t)}, |
| 127 |
{horizony(t)}, |
| 128 |
{horizonz(t)} |
| 129 |
); |
| 130 |
% Plot the azimuth curve |
| 131 |
\addplot3 [ |
| 132 |
domain=0:azimuth+0.5, |
| 133 |
samples=60, |
| 134 |
samples y=1, |
| 135 |
variable=t, |
| 136 |
horizon,coordinate curve, |
| 137 |
postaction={decorate}, |
| 138 |
decoration={markings, |
| 139 |
mark=at position 0.55 with {\arrow{Latex[round]}} |
| 140 |
} |
| 141 |
] ( |
| 142 |
{horizonx(t)}, |
| 143 |
{horizony(t)}, |
| 144 |
{horizonz(t)} |
| 145 |
); |
| 146 |
% Plot the great circle through the sun |
| 147 |
\addplot3 [ |
| 148 |
domain=0:360, |
| 149 |
samples=60, |
| 150 |
samples y=1, |
| 151 |
variable=t, |
| 152 |
elevation,help circle |
| 153 |
] ( |
| 154 |
{elevationx(t)}, |
| 155 |
{elevationy(t)}, |
| 156 |
{elevationz(t)} |
| 157 |
); |
| 158 |
% Plot the elevation curve |
| 159 |
\addplot3 [ |
| 160 |
domain=0.5:elevation, |
| 161 |
samples=60, |
| 162 |
samples y=1, |
| 163 |
variable=t, |
| 164 |
elevation,coordinate curve, |
| 165 |
postaction={decorate}, |
| 166 |
decoration={markings, |
| 167 |
mark=at position 0.5 with {\arrow{Latex[round]}} |
| 168 |
} |
| 169 |
] ( |
| 170 |
{elevationx(t)}, |
| 171 |
{elevationy(t)}, |
| 172 |
{elevationz(t)} |
| 173 |
) ; |
| 174 |
\draw [-{Latex[round]}, sun position] (0,0,0) -- (sunx, suny, sunz) node[anchor=south east,inner sep=0] {$\odot$}; |
| 175 |
\draw [sun position, thin](0,0,0) -- (uex, uey, 0); |
| 176 |
\node at (textazx, textazy, textazz) [anchor=north,coordinate angle] {\az}; |
| 177 |
\node at (textelx, textely, textelz) [anchor=east ,coordinate angle] {\el}; |
| 178 |
\end{axis} |
| 179 |
\end{tikzpicture} |
| 180 |
|
| 181 |
\end{document} |
| 182 |
|
| 183 |
|