Debian Codegraph @

texmf-dist/tex/latex/tikz-planets/planets.sty

raw
1 % Package tikz-planets -- illustrate celestial mechanics with TikZ
2 % Version 1.0.2
3
4 % Isabelle M. Santos
5 % This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
6 % To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/
7
8 % This program is distributed in the hope that it will be useful,
9 % but WITHOUT ANY WARRANTY; without even the implied warranty of
10 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
12 \ProvidesPackage{planets}[2020/04/19 v1.0.2 celestial mechanics with Tikz]
13
14 \RequirePackage{tikz}
15 \usetikzlibrary{decorations.pathmorphing}
16
17 \RequirePackage{xstring}
18
19 % Colors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20 \RequirePackage{xcolor}
21 \definecolor{mercury_crater_edge}{rgb}{.44, .42, .41}
22 \definecolor{mercury_crater}{rgb}{.55, .54, .54}
23 \definecolor{venus1}{rgb}{1, 1, .85}
24 \definecolor{venus2}{rgb}{1, .87, .68}
25 \definecolor{venus3}{rgb}{.96, .87, .7}
26 \definecolor{uranus_gray}{rgb}{.69, .77, .87}
27 \definecolor{uranus_blue}{rgb}{.69, .93, .98}
28 \definecolor{neptune1}{rgb}{.27, .51, .71}
29 \definecolor{neptune2}{rgb}{.25, .41, .88}
30 \definecolor{neptune3}{rgb}{.53, .85, .95}
31 \definecolor{neptune4}{rgb}{.12, .56, 1}
32 \definecolor{neptune5}{rgb}{.42, .35, .8}
33 \definecolor{neptune_white}{rgb}{94, 1, 1}
34 \definecolor{pluto1}{rgb}{.82, .77, .71}
35 \definecolor{pluto2}{rgb}{.24, .18, .11}
36
37 \definecolor{brownish}{rgb}{.7, .58, .42}
38 \definecolor{wheat}{rgb}{.96, .87, .7}
39 \definecolor{yellowish}{rgb}{1, 1, .88}
40 \definecolor{orangish}{rgb}{.82, .71, .55}
41 \definecolor{pinkish}{rgb}{1, .85, .73}
42 \definecolor{sienna}{rgb}{.50, .26, .14}
43 \definecolor{greenish}{rgb}{.8, .78, .64}
44 \definecolor{whiteish}{rgb}{.98, .92, .84}
45
46 % Keys %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 \newif\ifrotation
48 \newif\ifequator
49 \newif\ifaxis
50 \newif\ifretrograde
51 \newif\ifrings
52
53 \RequirePackage{pgfkeys}
54 \pgfkeys{
55 /planet/.is family, /planet,
56 surface/.estore in = \planets@surfacename,
57 tilt/.estore in = \planets@axialtilt,
58 phase/.estore in = \planets@phase,
59 rotation/.is if = rotation,
60 equator/.is if = equator,
61 axis/.is if = axis,
62 retrograde/.is if = retrograde,
63 rings/.is if = rings,
64 ring/.estore in = \planets@ringradius,
65 color/.estore in = \planets@mycolor,
66 center/.code={\pgfkeyssetvalue{center}{#1}\pgfkeysgetvalue{center}{\planets@center}},
67 centerx/.estore in = \planets@centerx,
68 centery/.estore in = \planets@centery,
69 scale/.estore in = \planets@scale,
70 default/.style = {
71 surface = none,
72 tilt = 0,
73 phase = full,
74 rotation = false,
75 equator = false,
76 axis = false,
77 retrograde = false,
78 rings = false,
79 ring =,
80 color = cyan,
81 centerx = 0,
82 centery = 0,
83 scale = 1,
84 }
85 }
86
87 % Decorators %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 \newcommand{\planets@addaxis}{%
89 \draw [ultra thick] (0, 2) --(0, 1);
90 \draw [ultra thick] (0, -2) -- (0, -1);
91 \draw [dotted] (0, -1) -- (0, 1);
92 }
93
94 \newcommand{\planets@addequator}{%
95 % Equateur
96 \draw [dashed] (-1, 0) -- (1, 0);
97 }
98
99 \newcommand{\planets@addrotation}{%
100 \ifretrograde
101 % equator arrow
102 \draw [->, very thick] (0, 0) -- (-0.4, 0);
103
104 % axis arrow
105 \draw [->] (.3, 1.5) arc (320 : 220 : 0.4) ;
106 \else
107 % equator arrow
108 \draw [->, very thick] (0, 0) -- (0.4, 0);
109
110 % axis arrow
111 \draw [->] (-.3, 1.5) arc (220 : 320 : 0.4) ;
112 \fi
113 }
114
115 \newcommand{\planets@addsurfacephase}[1]{%
116 \IfEqCase{#1}{%
117 {new}{\fill [opacity=0.6, black] (0, 0) circle (1);}
118 {first half}{\fill [opacity=0.6, black] (90:1) arc (90:270:1) -- cycle;}
119 {last half}{\fill [opacity=0.6, black] (90:1) arc (90:-90:1) -- cycle;}
120 {first crescent}{\fill [opacity=0.6, black] (270:1) arc (135:225:-1.41) -- (90:1) arc (90:270:1) -- cycle;}
121 {last crescent}{\fill [opacity=0.6, black] (90:1) arc (90:-90:1) -- (-90:1) arc (225:135:1.41) -- cycle;}
122 {waxing gibbous}{\fill [opacity=0.6, black] (90:1) arc (90:270:1) -- (270:1) arc (225:135:1.41) -- cycle;}
123 {waning gibbous}{\fill [opacity=0.6, black] (90:1) arc (90:-90:1) -- (-90:1) arc (135:225:-1.41) -- cycle;}
124 {top half}{\fill [opacity=0.6, black] (0:1) arc (0:-180:1) -- (-180:1) -- cycle;}
125 {bottom half}{\fill [opacity=0.6, black] (0:1) arc (0:180:1) -- (180:1) -- cycle;}
126 {full}{}
127 }
128 }
129
130 \newcommand{\planets@drawringpath}[1]{
131 \path[#1, even odd rule]
132 (0, 0) circle [x radius = 1.3, y radius = .13]
133 (0, 0) circle [x radius = 1.7, y radius = .17]
134 (0, 0) circle [x radius = 1.75, y radius = .175]
135 (0, 0) circle [x radius = 2.1, y radius = .21];
136 }
137 \newcommand{\planets@addringphase}[1]{%
138 \IfEqCase{#1}{%
139 {new}{
140 \clip (-.85, -.25) -- (.85, -.25) -- (1, 0) -- (-1, 0) -- cycle;
141 \planets@drawringpath{inner color=black, outer color=black, opacity=.6}
142 }
143 {first half}{
144 \clip (-1, -.1) -- (-1, .1) -- (-2.2, 0) -- (-2.2, 0) -- cycle;
145 \planets@drawringpath{inner color=black, outer color=black, opacity=.6}
146 }
147 {last half}{
148 \clip (1, -.1) -- (1, .1) -- (2.2, 0) -- (2.2, 0) -- cycle;
149 \planets@drawringpath{inner color=black, outer color=black, opacity=.6}
150 }
151 {first crescent}{
152 \clip (-1.1, 0) -- (-1.5, -.22) -- (0, -.22) -- (1, 0) -- cycle;
153 \planets@drawringpath{inner color=black, outer color=black, opacity=.6}
154 }
155 {last crescent}{
156 \clip (1.1, 0) -- (1.5, -.22) -- (0, -.22) -- (-1, 0) -- cycle;
157 \planets@drawringpath{inner color=black, outer color=black, opacity=.6}
158 }
159 {waxing gibbous}{
160 \clip (-1.2, 0) -- (-1.5, .22) -- (0, .22) -- (1, 0) -- cycle;
161 \planets@drawringpath{inner color=black, outer color=black, opacity=.6}
162 }
163 {waning gibbous}{
164 \clip (1.2, 0) -- (1.5, .22) -- (0, .22) -- (-1, 0) -- cycle;
165 \planets@drawringpath{inner color=black, outer color=black, opacity=.6}
166 }
167 {top half}{
168 %pass
169 }
170 {bottom half}{
171 \planets@drawringpath{inner color=black, outer color=black, opacity=.6}
172 }
173 {full}{
174 %pass
175 }
176 }
177 }
178 \newcommand{\planets@addrings}{%
179 \planets@drawringpath{inner color=yellowish!90!black,outer color=yellowish!90!black}
180 }
181
182 \newcommand{\planets@addthinring}[1]{%
183
184 \def\a{#1}
185 \def\b{\a/7}
186 \def\x{ sqrt( (\a*\a-\b*\b*\a*\a) / (\a*\a-\b*\b) ) }
187 \def\y{ sqrt( 1 - (\a*\a-\b*\b*\a*\a) / (\a*\a-\b*\b) ) }
188
189 \begin{scope}
190 \clip (-{\x}, 0) -- ({\x}, 0) -- ({\x}, 1) --({{\a}}, 1) -- ({\a}, -1) -- (-{\a}, -1) -- (-{\a}, 1) -- (-{\x}, 1) -- (-{\x}, 0) -- cycle;
191 \draw[gray] (0, 0) circle ({\a} and {\b});
192 \end{scope}
193 }
194
195 % Surfaces %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
196
197 \newcommand{\planets@sunsurface}{%
198 \draw [yellow!50, ultra thick, fill=yellow!85!red] (0, 0) circle (1);
199 }
200
201 \newcommand{\planets@mercurysurface}{%
202 \draw [gray!70!black, ultra thick, fill=gray] (0, 0) circle (1);
203
204 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.5 , 0.56 ) circle ( 0.094 );
205 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.23 , 0.31 ) circle ( 0.08 );
206 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.03 , 0.65 ) circle ( 0.06 );
207 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.17 , 0.79 ) circle ( 0.03 );
208 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.15 , 0.15 ) circle ( 0.02 );
209
210 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.17 , -0.07 ) circle ( 0.09);
211 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.01 , -0.28 ) circle ( 0.08 );
212 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.33 , -0.42 ) circle ( 0.07 );
213 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.01 , -0.54 ) circle ( 0.06 );
214 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.63 , -0.3 ) circle ( 0.06 );
215 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.02 , -0.88 ) circle ( 0.06 );
216 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.85 , -0.05 ) circle ( 0.04 );
217 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.61 , -0.14 ) circle ( 0.03 );
218 \draw [mercury_crater_edge, fill=mercury_crater] ( 0.7 , -0.16 ) circle ( 0.01 );
219
220 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.47 , -0.41 ) circle ( 0.08 );
221 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.2 , -0.87 ) circle ( 0.07 );
222 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.78 , -0.17 ) circle ( 0.03 );
223 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.32 , -0.29 ) circle ( 0.02 );
224 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.57 , -0.66 ) circle ( 0.02 );
225
226 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.38 , 0.49 ) circle ( 0.1 );
227 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.17 , 0.69 ) circle ( 0.09 );
228 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.16 , 0.26 ) circle ( 0.09 );
229 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.8 , 0.06 ) circle ( 0.08 );
230 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.83 , 0.28 ) circle ( 0.007 );
231 \draw [mercury_crater_edge, fill=mercury_crater] ( -0.23 , 0.51 ) circle ( 0.006 );
232 }
233
234 \pgfdeclareverticalshading{Venus}{2cm}{
235 color(0cm)=(venus1);
236 color(0.3cm)=(venus2);
237 color(1cm)=(venus3);
238 color(1.7cm)=(venus2!90!black);
239 color(1.9cm)=(venus1)
240 }
241 \newcommand{\planets@venussurface}{%
242 \draw [color=brown!40, shading=Venus, ultra thick] (0, 0) circle (1);
243 }
244
245 \newcommand{\planets@earthsurface}{
246 % Globe
247 \draw [fill=cyan] (0,0) circle (1);
248
249 % Continents
250 \draw [very thin, green, fill=green!70!black] (0.5, 0.45) circle (.3 and .2) ;
251 \draw [very thin, green, fill=green!70!black] (0.7, -.2) circle (.2 and .5) ;
252
253 \draw [very thin, green, fill=green!70!black] (-.6, 0.4) circle (.25 and .2) ;
254 \draw [very thin, green, fill=green!70!black] (-0.6, -.2) circle (.3 and .4) ;
255
256 % Poles
257 \fill [white] (-0.423, 0.906) arc (115 : 65 : 1) -- cycle ;
258 \fill [white] (-0.423, -0.906) arc (65 : 115 : -1) -- cycle ;
259
260 % Edge
261 \draw [neptune3, ultra thick] (0,0) circle (1);
262 }
263
264 \newcommand{\planets@southpolesurface}{
265 % Globe
266 \draw [fill=cyan] (0,0) circle (1);
267
268 % Continents
269 \draw [very thin, green, fill=green!70!black] (0.71, 0.71) circle (.2) ;
270 \draw [very thin, green, fill=green!70!black, rotate=30] (0.51, -0.86) circle (.3 and .2) ;
271 \draw [very thin, green, fill=green!70!black] (-0.46, 0.39) -- (-0.77, 0.64) arc (140 : 155 : 1) -- cycle ;
272
273 % Pole
274 \draw [fill=white] (0,0) circle (.4);
275
276 % Edge
277 \draw [neptune3, ultra thick] (0,0) circle (1);
278 }
279
280 \newcommand{\planets@northpolesurface}{
281 % Globe
282 \draw [fill=cyan] (0,0) circle (1);
283
284 % Continents
285 \draw [very thin, green, fill=green!70!black] (0.75, 0.05) circle (.5 and .75) ;
286 \draw [very thin, green, fill=green!70!black] (-0.71, 0.61) arc (135 : 200 : 1) arc (-135 : -80 : 1.2) arc (245 : 150 : 1) -- cycle ;
287
288 % Pole
289 \draw [fill=white] (0, -0.3) arc (-30 : 0 : 1) arc (0 : 180 : 0.2) arc (20 : 5 : 2) -- cycle ;
290
291 % Edge
292 \draw [neptune3, ultra thick] (0,0) circle (1);
293 }
294
295 \newcommand{\planets@moonsurface}{%
296 % Disc
297 \draw [fill=gray!30] (0, 0) circle (1);
298
299 % Craters
300 \draw [gray!60, ultra thick, fill=gray!55] (-.55, .2) circle (.4);
301 \draw [gray!65, ultra thick, fill=gray!60] (-.1, .65) circle (.3);
302
303 \draw [gray!15, ultra thick, fill=gray!20] (-.2, -.5) circle (.1);
304
305 \draw [gray!75, ultra thick, fill=gray!70] (.4, .5) circle (.15);
306 \draw [gray!75, ultra thick, fill=gray!70] (.6, .3) circle (.15);
307
308 \draw [gray!55, ultra thick, fill=gray!50] (.2, -.2) circle (.2);
309
310 % Small craters
311 \draw [gray, very thick, fill=gray!80] (.1, -.7) circle (.05);
312 \draw [gray, very thick, fill=gray!80] (.8, -.2) circle (.05);
313 \draw [gray, very thick, fill=gray!80] (-.3, .7) circle (.05);
314 \draw [gray, very thick, fill=gray!80] (-.1, .6) circle (.05);
315 \draw [gray, very thick, fill=gray!80] (-.2, 0) circle (.05);
316
317 % Edge
318 \draw [gray!40, ultra thick] (0, 0) circle (1);
319 }
320
321 \newcommand{\planets@marssurface}{%
322 \draw [fill=red!50!brown] (0, 0) circle (1);
323
324 % Poles
325 \fill [white] (110:1) arc (110 : 70 : 1) -- cycle ;
326 \fill [white] (-110:1) arc (70 : 110 : -1) -- cycle ;
327
328 % Edge
329 \draw [color=red!60!black, ultra thick] (0, 0) circle (1);
330 }
331
332 \newcommand{\planets@marspolesurface}{
333 % Globe
334 \draw [fill=red!50!brown] (0, 0) circle (1);
335
336 % Pole
337 \draw [color=blue!50!white, fill=white, decorate, decoration={bumps, amplitude=.1}] (0,0) circle (.2);
338
339 % Edge
340 \draw [color=red!60!black, ultra thick] (0, 0) circle (1);
341 }
342
343 \newcommand{\planets@jupitersurface}{
344 \draw[color=brown!60, fill=brown!20, ultra thick] (0, 0) circle (1);
345
346 %Stripes
347 \clip (0, 0) circle (1);
348 \fill [color=brown!70, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (-1.2, -.25) -- (1.1, -.25) -- (1.1, .25) -- (-1.2, .25) -- cycle;
349
350 \fill [color=brown!70, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (130:1) -- (50:1) -- (50:2) arc (50:130:2) -- cycle;
351 \fill [color=brown!70, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (130:-1) -- (50:-1) -- (50:-2) arc (50:130:-2) -- cycle;
352
353 \fill [color=brown!30, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (-1.2, -.03) -- (1.1, -.03) -- (1.1, .03) -- (-1.2, .03) -- cycle;
354
355 \fill [color=brown!50, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (-1.2, .5) -- (1.1, .5) -- (1.1, .54) -- (-1.2, .54) -- cycle;
356 \fill [color=brown!50, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (-1.2, -.5) -- (1.1, -.5) -- (1.1, -.54) -- (-1.2, -.54) -- cycle;
357
358 % Spot
359 \fill[color=red!50!brown] (-.4, -.3) circle (.18 and .14);
360 }
361
362 \pgfdeclareverticalshading{Jupiter}{2cm}{
363 color(0cm)=(brownish);
364 color(0.2cm)=(wheat!55!sienna);
365 color(0.4cm)=(yellowish);
366 color(0.7cm)=(orangish);
367 color(0.9cm)=(white);
368 color(1cm)=(whiteish!70!orangish);
369 color(1.1cm)=(wheat);
370 color(1.3cm)=(sienna);
371 color(1.5cm)=(pinkish);
372 color(1.6cm)=(brownish);
373 color(1.7cm)=(white);
374 color(1.9cm)=(wheat!90!black)
375 }
376 \newcommand{\planets@shadedjupitersurface}{%
377 \draw [color=brown!50, shading=Jupiter, ultra thick] (0, 0) circle (1);
378
379 % Spot
380 \draw [brownish!50!orangish, thick, fill=orange!50!red] (-0.4, -0.25) circle (.13 and .1);
381 }
382
383 \pgfdeclareverticalshading{Saturn}{2cm}{
384 color(0cm)=(whiteish!55!black);
385 color(0.1cm)=(greenish!50);
386 color(0.15cm)=(whiteish);
387 color(0.25cm)=(greenish);
388 color(0.3cm)=(whiteish!50!orangish);
389 color(0.6cm)=(greenish);
390 color(0.7cm)=(wheat!90!black);
391 color(0.85cm)=(wheat);
392 color(0.95cm)=(pinkish);
393 color(1cm)=(pinkish);
394 color(1.1cm)=(wheat);
395 color(1.2cm)=(wheat!90!black);
396 color(1.3cm)=(greenish);
397 color(1.5cm)=(whiteish!50!orangish);
398 color(1.7cm)=(yellowish!70!orangish);
399 color(1.9cm)=(whiteish!55!sienna)
400 }
401 \newcommand{\planets@saturnsurface}{%
402 \draw [color=yellowish, shading=Saturn, ultra thick, shading angle=\planets@axialtilt] (0, 0) circle (1);
403 }
404
405 \newcommand{\planets@uranussurface}{%
406 \draw [color=uranus_gray, fill=uranus_blue, ultra thick] (0, 0) circle (1);
407 }
408
409 \pgfdeclareverticalshading{Neptune}{2cm}{
410 color(0cm)=(neptune1!90!black);
411 color(0.35cm)=(neptune2);
412 color(0.4cm)=(neptune_white);
413 color(0.45cm)=(neptune2);
414 color(1.2cm)=(neptune3);
415 color(1.6cm)=(neptune4);
416 color(1.9cm)=(neptune5)
417 }
418 \newcommand{\planets@neptunesurface}{%
419 \draw [color=blue!40, shading=Neptune, ultra thick, shading angle=\planets@axialtilt] (0, 0) circle (1);
420 }
421
422 \pgfdeclareverticalshading{Pluto}{2cm}{
423 color(0cm)=(pluto1);
424 color(.4cm)=(pluto2);
425 color(.7cm)=(pluto2);
426 color(1.2cm)=(pluto1);
427 color(1.9cm)=(pluto1)
428 }
429 \newcommand{\planets@plutosurface}{%
430 \fill [shading=Pluto, shading angle=\planets@axialtilt] (0, 0) circle (1);
431
432 \fill [pluto1, thick, domain=-150:100, samples=50]
433 plot ({ .67*sin(\x) * sin(\x) * sin(\x) + .5 },
434 { .65 * cos(\x) - .2 * cos(2*\x) - .1 * cos(3*\x) - .05 * cos(4*\x) - .4 } );
435
436 \draw [color=pluto2!50, ultra thick] (0,0) circle (1);
437 }
438
439 \newcommand{\planets@genericsurface}{
440 \draw [color=white!50!\planets@mycolor, fill=\planets@mycolor, ultra thick] (0, 0) circle (1);
441 }
442
443 \newcommand{\planets@addsurface}[1]{%
444 \IfEqCase{#1}{%
445 {earth}{\planets@earthsurface}
446 {north pole}{\planets@northpolesurface}
447 {south pole}{\planets@southpolesurface}
448 {moon}{\planets@moonsurface}
449 {sun}{\planets@sunsurface}
450 {mars}{\planets@marssurface}
451 {mars pole}{\planets@marspolesurface}
452 {mercury}{\planets@mercurysurface}
453 {venus}{\planets@venussurface}
454 {jupiter}{\planets@jupitersurface}
455 {shaded jupiter}{\planets@shadedjupitersurface}
456 {saturn}{\planets@saturnsurface}
457 {uranus}{\planets@uranussurface}
458 {neptune}{\planets@neptunesurface}
459 {pluto}{\planets@plutosurface}
460 {none}{\planets@genericsurface}
461 }
462 }
463
464
465 % Main command %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
466 \newcommand{\planet}[1][]{\begingroup%
467 \pgfkeys{/planet, default, #1}
468
469 \pgfkeysifdefined{center}{%if
470 % pass
471 }{%else
472 \def\planets@center{(\planets@centerx, \planets@centery)}
473 }
474
475 \IfStrEqCase{\planets@surfacename}{{saturn}{\ringstrue}}
476
477 \begin{scope}[shift = (\planets@center), scale = \planets@scale]
478
479 \ifrings
480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481 \begin{scope}[rotate=\planets@axialtilt]% bottom half
482 \clip (0, 0) circle (1);
483 \planets@addsurface{\planets@surfacename}
484 \end{scope}
485 \begin{scope}
486 \planets@addsurfacephase{\planets@phase}
487 \end{scope}
488 \begin{scope}[rotate=\planets@axialtilt]
489 \planets@addrings
490 \planets@addringphase{\planets@phase}
491 \end{scope}
492 \begin{scope}[rotate=\planets@axialtilt]% top half
493 \clip (-1, 0) rectangle (1, 1);
494 \clip (0, 0) circle (1);
495 \planets@addsurface{\planets@surfacename}
496 \end{scope}
497 \begin{scope}
498 \clip (\planets@axialtilt : -1.1) -- (\planets@axialtilt : 1.1) -- (1.1, 1.1) -- (-1.1, 1.1) -- cycle;
499 \planets@addsurfacephase{\planets@phase}
500 \end{scope}
501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
502 \else
503 \begin{scope}[rotate=\planets@axialtilt]
504 \clip (0, 0) circle (1);
505 \planets@addsurface{\planets@surfacename}
506 \end{scope}
507 \planets@addsurfacephase{\planets@phase}
508 \fi
509
510 \ifrotation
511 \begin{scope}[rotate=\planets@axialtilt]
512 \planets@addaxis
513 \planets@addequator
514 \planets@addrotation
515 \end{scope}
516 \fi
517
518 \ifequator
519 \begin{scope}[rotate=\planets@axialtilt]
520 \planets@addequator
521 \end{scope}
522 \fi
523
524 \ifaxis
525 \begin{scope}[rotate=\planets@axialtilt]
526 \planets@addaxis
527 \end{scope}
528 \fi
529
530 \IfStrEq{\planets@ringradius}{}{%
531 %pass
532 }{%
533 \begin{scope}[rotate=\planets@axialtilt]
534 \planets@addthinring{\planets@ringradius}
535 \end{scope}
536 }%
537
538 \end{scope}
539 \endgroup
540 }
541