\ProvidesPackage{planets} \RequirePackage{tikz} \RequirePackage{xstring} % Colors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \RequirePackage{xcolor} \definecolor{mercury_crater_edge}{rgb}{.44, .42, .41} \definecolor{mercury_crater}{rgb}{.55, .54, .54} \definecolor{venus1}{rgb}{1, 1, .85} \definecolor{venus2}{rgb}{1, .87, .68} \definecolor{venus3}{rgb}{.96, .87, .7} \definecolor{uranus_gray}{rgb}{.69, .77, .87} \definecolor{uranus_blue}{rgb}{.69, .93, .98} \definecolor{neptune1}{rgb}{.27, .51, .71} \definecolor{neptune2}{rgb}{.25, .41, .88} \definecolor{neptune3}{rgb}{.53, .85, .95} \definecolor{neptune4}{rgb}{.12, .56, 1} \definecolor{neptune5}{rgb}{.42, .35, .8} \definecolor{neptune_white}{rgb}{94, 1, 1} \definecolor{brownish}{rgb}{.7, .58, .42} \definecolor{wheat}{rgb}{.96, .87, .7} \definecolor{yellowish}{rgb}{1, 1, .88} \definecolor{orangish}{rgb}{.82, .71, .55} \definecolor{pinkish}{rgb}{1, .85, .73} \definecolor{sienna}{rgb}{.50, .26, .14} \definecolor{greenish}{rgb}{.8, .78, .64} \definecolor{whiteish}{rgb}{.98, .92, .84} % Keys %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newif\ifrotation \newif\ifretrograde \newif\ifring \RequirePackage{pgfkeys} \pgfkeys{ /planet/.is family, /planet, surface/.estore in = \surface, tilt/.estore in = \tilt, phase/.estore in = \phase, rotation/.is if = rotation, retrograde/.is if = retrograde, color/.estore in = \mycolor, centerx/.estore in = \centerx, centery/.estore in = \centery, scale/.estore in = \scale, default/.style = { surface = none, tilt = 0, phase = full, rotation = false, retrograde = false, color = cyan, centerx = 0, centery = 0, scale = 1, } } % Decorators %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\addaxis}{% \draw [ultra thick] (0,2) --(0, -2); } \newcommand{\addequator}{% % Equateur \draw [dashed] (-1, 0) -- (1, 0); } \newcommand{\addrotation}{% % equator arrow \ifretrograde \draw [->, very thick] (0, 0) -- (-0.4, 0); % axis arrow \draw [->] (.3, 1.5) arc (320 : 220 : 0.4) ; \else % equator arrow \draw [->, very thick] (0, 0) -- (0.4, 0); % axis arrow \draw [->] (-.3, 1.5) arc (220 : 320 : 0.4) ; \fi } \newcommand{\addphase}[1]{% \IfEqCase{#1}{% {new}{\fill [opacity=0.6, black] (0, 0) circle (1);} {first half}{\fill [opacity=0.6, black] (90:1) arc (90:270:1) -- cycle;} {last half}{\fill [opacity=0.6, black] (90:1) arc (90:-90:1) -- cycle;} {first crescent}{\fill [opacity=0.6, black] (270:1) arc (135:225:-1.41) -- (90:1) arc (90:270:1) -- cycle;} {last crescent}{\fill [opacity=0.6, black] (90:1) arc (90:-90:1) -- (-90:1) arc (225:135:1.41) -- cycle;} {waxing gibbous}{\fill [opacity=0.6, black] (90:1) arc (90:270:1) -- (270:1) arc (225:135:1.41) -- cycle;} {waning gibbous}{\fill [opacity=0.6, black] (90:1) arc (90:-90:1) -- (-90:1) arc (135:225:-1.41) -- cycle;} {top half}{\fill [opacity=0.6, black] (0:1) arc (0:-180:1) -- (-180:1) -- cycle;} {bottom half}{\fill [opacity=0.6, black] (0:1) arc (0:180:1) -- (180:1) -- cycle;} {full}{} } } % Surfaces %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\sun}{% \draw [yellow!50, ultra thick, fill=yellow!85!red] (0, 0) circle (1); } \newcommand{\mercury}{% \draw [gray!70!black, ultra thick, fill=gray] (0, 0) circle (1); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.5 , 0.56 ) circle ( 0.094 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.23 , 0.31 ) circle ( 0.08 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.03 , 0.65 ) circle ( 0.06 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.17 , 0.79 ) circle ( 0.03 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.15 , 0.15 ) circle ( 0.02 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.17 , -0.07 ) circle ( 0.09); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.01 , -0.28 ) circle ( 0.08 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.33 , -0.42 ) circle ( 0.07 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.01 , -0.54 ) circle ( 0.06 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.63 , -0.3 ) circle ( 0.06 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.02 , -0.88 ) circle ( 0.06 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.85 , -0.05 ) circle ( 0.04 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.61 , -0.14 ) circle ( 0.03 ); \draw [mercury_crater_edge, fill=mercury_crater] ( 0.7 , -0.16 ) circle ( 0.01 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.32 , -0.29 ) circle ( 0.02 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.47 , -0.41 ) circle ( 0.08 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.2 , -0.87 ) circle ( 0.07 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.78 , -0.17 ) circle ( 0.03 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.57 , -0.66 ) circle ( 0.02 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.38 , 0.49 ) circle ( 0.1 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.17 , 0.69 ) circle ( 0.09 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.16 , 0.26 ) circle ( 0.09 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.8 , 0.06 ) circle ( 0.08 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.83 , 0.28 ) circle ( 0.007 ); \draw [mercury_crater_edge, fill=mercury_crater] ( -0.23 , 0.51 ) circle ( 0.006 ); } \pgfdeclareverticalshading{Venus}{2cm}{ color(0cm)=(venus1); color(0.3cm)=(venus2); color(1cm)=(venus3); color(1.7cm)=(venus2!90!black); color(1.9cm)=(venus1) } \newcommand{\venus}{% \draw [color=brown!40, shading=Venus, ultra thick] (0, 0) circle (1); } \newcommand{\earth}{ % Globe \draw [fill=cyan] (0,0) circle (1); % Continents \draw [very thin, green, fill=green!70!black] (0.5, 0.45) circle (.3 and .2) ; \draw [very thin, green, fill=green!70!black] (0.7, -.2) circle (.2 and .5) ; \draw [very thin, green, fill=green!70!black] (-.6, 0.4) circle (.25 and .2) ; \draw [very thin, green, fill=green!70!black] (-0.6, -.2) circle (.3 and .4) ; % Poles \fill [white] (-0.423, 0.906) arc (115 : 65 : 1) -- cycle ; \fill [white] (-0.423, -0.906) arc (65 : 115 : -1) -- cycle ; % Edge \draw [neptune3, ultra thick] (0,0) circle (1); } \newcommand{\moon}{% % Disque \draw [fill=gray!30] (0, 0) circle (1); % Crateres \draw [gray!60, ultra thick, fill=gray!55] (-.55, .2) circle (.4); \draw [gray!65, ultra thick, fill=gray!60] (-.1, .65) circle (.3); \draw [gray!15, ultra thick, fill=gray!20] (-.2, -.5) circle (.1); \draw [gray!75, ultra thick, fill=gray!70] (.4, .5) circle (.15); \draw [gray!75, ultra thick, fill=gray!70] (.6, .3) circle (.15); \draw [gray!55, ultra thick, fill=gray!50] (.2, -.2) circle (.2); % Petits crateres \draw [gray, very thick, fill=gray!80] (.1, -.7) circle (.05); \draw [gray, very thick, fill=gray!80] (.8, -.2) circle (.05); \draw [gray, very thick, fill=gray!80] (-.3, .7) circle (.05); \draw [gray, very thick, fill=gray!80] (-.1, .6) circle (.05); \draw [gray, very thick, fill=gray!80] (-.2, 0) circle (.05); % Bord \draw [gray!40, ultra thick] (0, 0) circle (1); } \newcommand{\mars}{% \draw [fill=red!50!brown] (0, 0) circle (1); % Poles \fill [white] (110:1) arc (110 : 70 : 1) -- cycle ; \fill [white] (-110:1) arc (70 : 110 : -1) -- cycle ; % Edge \draw [color=red!60!black, ultra thick] (0, 0) circle (1); } \pgfdeclareverticalshading{Jupiter}{2cm}{ color(0cm)=(brownish); color(0.2cm)=(wheat!55!sienna); color(0.4cm)=(yellowish); color(0.7cm)=(orangish); color(0.9cm)=(white); color(1cm)=(whiteish!70!orangish); color(1.1cm)=(wheat); color(1.3cm)=(sienna); color(1.5cm)=(pinkish); color(1.6cm)=(brownish); color(1.7cm)=(white); color(1.9cm)=(wheat!90!black) } \newcommand{\jupiter}{% \draw [color=brown!80!yellow, shading=Jupiter, ultra thick] (0, 0) circle (1); % Spot \draw [brownish!50!orangish, thick, fill=orange!50!red] (-0.4, -0.25) circle (.13 and .1); } \pgfdeclareverticalshading{SaturnBottom}{2cm}{ color(0cm)=(whiteish!55!black); color(0.2cm)=(greenish!50); color(0.3cm)=(whiteish); color(0.5cm)=(greenish); color(0.6cm)=(whiteish!50!orangish); color(1.2cm)=(greenish); color(1.4cm)=(wheat!90!black); color(1.7cm)=(wheat); color(1.9cm)=(pinkish) } \pgfdeclareverticalshading{SaturnTop}{2cm}{ color(0cm)=(pinkish); color(.1cm)=(wheat); color(.3cm)=(wheat!90!black); color(.6cm)=(greenish); color(1cm)=(whiteish!50!orangish); color(1.4cm)=(yellowish!70!orangish); color(1.8cm)=(whiteish!55!sienna) } \newcommand{\saturn}{% % Top half \fill [color=yellowish, shading=SaturnTop, ultra thick] (0:1) arc (0:180:1) -- cycle; \draw [yellowish, ultra thick] (0:1) arc (0:180:1); % Ring \path[inner color=black,outer color=yellowish,even odd rule] (0, 0) circle [x radius = 1.5, y radius = .25] (0, 0) circle [x radius = 1.7, y radius = .3] (0, 0) circle [x radius = 1.75, y radius = .33] (0, 0) circle [x radius = 1.95, y radius = .38]; % Bottom half \fill [color=yellowish, shading=SaturnBottom, ultra thick] (180:1) arc (180:360:1) -- cycle; \draw [yellowish, ultra thick] (180:1) arc (180:360:1); } \newcommand{\uranus}{% \draw [color=uranus_gray, fill=uranus_blue, ultra thick] (0, 0) circle (1); } \pgfdeclareverticalshading{Neptune}{2cm}{ color(0cm)=(neptune1!90!black); color(0.35cm)=(neptune2); color(0.4cm)=(neptune_white); color(0.45cm)=(neptune2); color(1.2cm)=(neptune3); color(1.6cm)=(neptune4); color(1.9cm)=(neptune5) } \newcommand{\neptune}{% \draw [color=blue!40, shading=Neptune, ultra thick] (0, 0) circle (1); } \newcommand{\addsurface}[1]{% \IfEqCase{#1}{% {earth}{\earth} {moon}{\moon} {sun}{\sun} {mars}{\mars} {mercury}{\mercury} {venus}{\venus} {jupiter}{\jupiter} {saturn}{\saturn} {uranus}{\uranus} {neptune}{\neptune} {none}{} } } % Main command %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\planet}[1][]{% \pgfkeys{/planet, default, #1} \begin{scope}[shift = {(\centerx, \centery)}, scale = \scale] % Circle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \draw [color=white!50!\mycolor, ultra thick, fill=\mycolor] (0, 0) circle (1); \begin{scope}[rotate=\tilt] \addsurface{\surface} \end{scope} \ifrotation \begin{scope}[rotate=\tilt] \addaxis \addequator \addrotation \end{scope} \fi \addphase{\phase} \end{scope} }