summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/standard/saturn.mp
blob: 44be273cc73c06391ded73357888c87414360109 (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
109
110
111
% saturn.mp
% L. Nobre G.
% 2005

verbatimtex
\documentclass{article}
\usepackage{newcent}
\pagestyle{empty}
\begin{document}
etex

f := 2.5*(5,0,-1);
Spread := 100;

beginfig(1);
  path planet, twilight, darkness, ringins, ringout, shadein, shadout;
  path fullplanet, fullring, backdark, sunplanet, backring;
  path nearringout, nearringins, hdtv, darkplanet;
  numeric planetray, ringinsray, ringoutray, cutmargin, athmosray;
  color sunposition, axedirection, labelpos, darknesstart, darknessend;
  numeric inclinangle, labelray, begintime, endtime, colorfactor;
  color planetcolor, ringcolor, toptextcolor, deepskycolor, bottextcolor;
  picture storepicture;
  planetray = 1;
  ringinsray = 1.6;
  ringoutray = 2.3;
  labelray = 2.1;
  cutmargin = 0.01;
  inclinangle = 15;
  sunposition = (-7,15,4);
  colorfactor = 1.3;
  bboxmargin := 6mm;
  planetcolor = colorfactor*(255,152,55)/255;
  ringcolor = colorfactor*(221,57,199)/255;
  toptextcolor = colorfactor*(187,164,109)/255;
  deepskycolor = colorfactor*(11,18,84)/255;
  bottextcolor = colorfactor*(15,103,23)/255;
  viewcentr := (0,0.5[planetray,ringinsray],0);
  labelpos = (0,labelray,0);
  athmosray = planetray+cutmargin;
  axedirection = (0,-sind(inclinangle),cosd(inclinangle));
  planet = rigorousfearpath( black, planetray );
  twilight = spatialhalfcircle( black, sunposition, athmosray, true );
  darknesstart = athmosray*ncrossprod( sunposition, axedirection );
  darknessend = darknesstart - labelray*N( sunposition );
  darkness = pathofstraightline( darknesstart, darknessend );
  darknesstart := -darknesstart;
  darknessend := darknesstart - labelray*N( sunposition );
  backdark = pathofstraightline( darknesstart, darknessend );
  ringins = goodcirclepath( black, axedirection, ringinsray );
  ringout = goodcirclepath( black, axedirection, ringoutray );
  endtime = xpart ( planet intersectiontimes twilight );
  begintime = xpart ( reverse planet intersectiontimes twilight );
  sunplanet = subpath (-begintime-cutmargin,endtime+cutmargin) of planet;
  darkplanet = planet cutbefore twilight cutafter twilight;
  fullplanet = buildcycle( sunplanet, reverse twilight );
  fill fullplanet withcolor planetcolor;
  endtime := xpart ( ringins intersectiontimes darkness );
  begintime := xpart ( reverse ringins intersectiontimes sunplanet );
  nearringins = subpath (-begintime-cutmargin,endtime+cutmargin) of ringins;
  endtime := xpart ( ringout intersectiontimes darkness );
  begintime := xpart ( reverse ringout intersectiontimes sunplanet );
  nearringout = subpath (-begintime-cutmargin,endtime+cutmargin) of ringout;
  backring = buildcycle( backdark, ringout, reverse darkplanet, reverse ringins );
  fullring = buildcycle( nearringout, reverse darkness, reverse nearringins, sunplanet );
  fill backring withcolor ringcolor;
  fill fullring withcolor ringcolor;
  picture thestatement;
  thestatement = thelabel(
    btex
      \begin{tabular}{c}
        \textbf{\textsf{{\Large T}$\!$ecnumbria}} \\
        \textsf{\scriptsize a sombra da tecnologia}
      \end{tabular}
    etex,
    origin);
  pickup pencircle scaled 1pt;
  draw thestatement scaled 2 shifted rp(labelpos) withcolor toptextcolor;
  storepicture = currentpicture;
  z1 = lrcorner currentpicture;
  z2 = urcorner currentpicture;
  z3 = ulcorner currentpicture;
  z4 = llcorner currentpicture;
  z5 = z1+down*bboxmargin;
  z6 = z1+right*bboxmargin;
  z7 = z2+right*bboxmargin;
  z8 = z2+up*bboxmargin;
  z9 = z3+up*bboxmargin;
  z10= z3+left*bboxmargin;
  z11= z4+left*bboxmargin;
  z12= z4+down*bboxmargin;
  z13= 0.5[z5,z12]+down*3*bboxmargin;
  hdtv = z5..z6---z7..z8---z9..z10---z11..z12---cycle;
  fill hdtv withcolor deepskycolor;
  draw storepicture;
  label(btex \texttt{\LARGE http://tecnumbria.com} etex, z13 );
endfig;

beginfig(2);
  prologues := 1;
  pickup pencircle scaled 5pt;
  draw fullplanet;
  unfill fullring;
  draw fullring;
  draw backring;
endfig;

verbatimtex \end{document} etex

end;