-
Notifications
You must be signed in to change notification settings - Fork 0
/
EudoxusPlanetary.tex
executable file
·159 lines (133 loc) · 5.5 KB
/
EudoxusPlanetary.tex
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
% Eudoxus planetary model (animated)
% Author: Tobit Flatscher (https://github.com/2b-t)
%
% Description
% This document creates an animated Eudoxus planetary model by using
% the integrated transformation features and a manual transformation.
% document settings
\documentclass{standalone}
\usepackage{tikz, tikz-3dplot}
\usepackage{xintexpr}
\usetikzlibrary{calc,patterns,fadings,decorations.pathreplacing}
\usepackage{animate}
% useful commands
\newcommand\pgfmathsinandcos[3]{
\pgfmathsetmacro#1{sin(#3)}
\pgfmathsetmacro#2{cos(#3)}
}
\newcommand\LongitudePlane[3][current plane]{
\pgfmathsinandcos\sinEl\cosEl{#2} %elevation
\pgfmathsinandcos\sint\cost{#3} %azimuth
\tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\LatitudePlane[3][current plane]{
\pgfmathsinandcos\sinEl\cosEl{#2} %elevation
\pgfmathsinandcos\sint\cost{#3} %latitude
\pgfmathsetmacro\yshift{\cosEl*\sint}
\tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}}
}
\newcommand\DrawLongitudeCircle[2][1]{
\LongitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}} %angle of "visibility"
\pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))}
\draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
}
\newcommand\DrawLatitudeCircle[2][1]{
\LatitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
\pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)} %angle of "visibility"
\pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
\draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1);
}
% document-wide Tikz options
\tikzset{
>=latex, %option for nice arrows
inner sep=0pt,
outer sep=2pt,
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
fill=black,circle}
}
% colours (rgb)
\definecolor{earth}{rgb}{0.3, 0.3, 0.8}
\definecolor{inner}{rgb}{0.44, 0.31, 0.22}
\definecolor{outer}{rgb}{0.55, 0.44, 0.28}
% geometry parameters
\def\offset{80} %sphere radius offset
\def\Ra{2.5} %world sphere radius
\def\Rb{7} %inner sphere radius
\def\Rc{8} %outer sphere radius
\def\Rd{0.75} %sphere planet radius
\def\Re{6} %middle sphere radius
\def\angEl{35} %elevation angle
\begin{document}
\tdplotsetmaincoords{50}{30}
\begin{tikzpicture}
\foreach \i in {0,...,359}
{
\tdplotsetrotatedcoords{-45}{\i}{110}
\begin{scope}[tdplot_rotated_coords]
\pgfmathsinandcos\sinC\cosC{\i-\offset}
\pgfmathsinandcos\sinD\cosD{\i}
\coordinate (P\i) at ({0},{\sinC*\Rc},{\cosC*\Rc});
\end{scope}
}
\end{tikzpicture}
\begin{animateinline}[loop, poster = first, controls]{24}
\multiframe{90}{iAngle=0+4}{
\tdplotsetmaincoords{50}{30}
\begin{tikzpicture}
% bounding box
\useasboundingbox[tdplot_screen_coords] (-10,-8) rectangle (10,8);
\tdplotsetrotatedcoords{-45}{\iAngle}{110}
\begin{scope}[tdplot_rotated_coords]
\pgfmathsinandcos\sinC\cosC{\iAngle-\offset}
\xintifboolexpr {\iAngle > 180}
{\draw[outer,line width=0.5mm] (\Rc,0,0) [y={(0,\sinC,\cosC)}] arc(0:180:\Rc);}
{\draw[outer,line width=0.5mm] (\Rc,0,0) [y={(0,\sinC,\cosC)}] arc(0:-180:\Rc);}
\end{scope}
\tdplotsetrotatedcoords{-45}{\iAngle}{110}
\begin{scope}[tdplot_rotated_coords]
\xintifboolexpr {\iAngle > 180}
{\draw[inner,line width=0.5mm] (\Rb,0,0) arc(0:180:\Rb);}
{\draw[inner,line width=0.5mm] (\Rb,0,0) arc(0:-180:\Rb);}
\end{scope}
\draw[black,dashed] (0,-0.85*\Ra,0) -- (0,-\Re,0);
\filldraw[ball color=earth] (0,0) circle (\Ra);
\pgfmathsetmacro\a{\iAngle/3-5};
\pgfmathsetmacro\b{\iAngle/3-35};
\pgfmathsetmacro\c{\iAngle/3-175};
\foreach \t in {-80,-60,...,80} { \DrawLatitudeCircle[\Ra]{\t} }
\foreach \t in {\a,\b,...,\c} { \DrawLongitudeCircle[\Ra]{\t} }
\draw[black,dashed] (0,0.85*\Ra,0) -- (0,\Re,0);
\draw[line width=0.5mm] (0,0,0) [y={(0,1,0)}] circle (\Re);
\tdplotsetrotatedcoords{-45}{\iAngle}{110}
\begin{scope}[tdplot_rotated_coords]
\xintifboolexpr {\iAngle > 180}
{\draw[inner,line width=0.5mm] (\Rb,0,0) arc(0:-180:\Rb);}
{\draw[inner,line width=0.5mm] (\Rb,0,0) arc(0:180:\Rb);}
\end{scope}
\foreach \i in {1,...,359}
{
\pgfmathsetmacro\j{\i-1};
\draw[line width=0.25mm,gray] (P\j) -- (P\i);
}
\tdplotsetrotatedcoords{-45}{0}{0}
\begin{scope}[tdplot_rotated_coords]
\draw[inner,dashed] (0,\Rb,0) -- (0,\Re,0);
\draw[inner,dashed] (0,-\Rb,0) -- (0,-\Re,0);
\end{scope}
\tdplotsetrotatedcoords{-45}{\iAngle}{110}
\begin{scope}[tdplot_rotated_coords]
\draw[outer,dashed] (\Rb,0,0) -- (\Rc,0,0);
\draw[outer,dashed] (-\Rb,0,0) -- (-\Rc,0,0);
\pgfmathsinandcos\sinC\cosC{\iAngle-\offset}
\pgfmathsinandcos\sinD\cosD{\iAngle}
\xintifboolexpr {\iAngle > 180}
{\draw[outer,line width=0.5mm] (\Rc,0,0) [y={(0,\sinC,\cosC)}] arc(0:-180:\Rc);}
{\draw[outer,line width=0.5mm] (\Rc,0,0) [y={(0,\sinC,\cosC)}] arc(0:180:\Rc);}
\filldraw[ball color=white] (0, \sinC*\Rc, \cosC*\Rc) [y={(0,\sinD,\cosD)}] circle (\Rd);
\end{scope}
\end{tikzpicture}
}
\end{animateinline}
\end{document}