Debian Codegraph @

texmf-dist/doc/metapost/featpost/example/tropicalglobe.mp

raw
1 % tropicalglobe.mp
2 % L. Nobre G.
3 % 2012
4
5 input featpost3Dplus2D;
6
7 verbatimtex \documentclass{article}\begin{document} etex
8
9 beginfig(1);
10 numeric radius, numc;
11 pen thickp;
12
13 f := (3,0,2);
14 viewcentr := 0.5*(1,1,1);
15 Spread := 20;
16 radius = 1;
17 numc = 18;
18 thickp = pencircle scaled 1mm;
19
20 drawoptions( withpen thickp );
21 tropicalglobe( numc, black, radius, blue );
22 produce_auto_scale;
23 endfig;
24
25 beginfig(2);
26 color gammacnt, earthaxis;
27 numeric newradius, aux, i, foc, lc;
28 path conepath, latpath;
29 picture theglobe;
30
31 f := (5,2,4);
32 viewcentr := black;
33 Spread := 70;
34 radius := 1;
35 numc := 9;
36 thickp := pencircle scaled 0.5mm;
37
38 earthaxis = eulerrotation( 0, 0, 23, blue);
39 pickup thickp;
40 tropicalglobe( numc, black, radius, earthaxis );
41 for i=1 upto numc: % longitudes
42 aux := (i-1)*180/numc;
43 gammacnt := eulerrotation( 0, 0, 23, (cosd(aux),sind(aux),0) );
44 draw spatialhalfcircle(black,gammacnt,radius,true);
45 endfor;
46 theglobe = currentpicture;
47 endfig;
48
49 beginfig(3);
50 draw theglobe;
51 TDAtiplen := 0.15; % tdarrow and tdcircarrow
52 TDAhalftipbase := 0.06; % Three-Dimensional (Circular)
53 TDAhalfthick := 0.03; % Arrow
54 path planet, twilight, shadowplanet, fullplanet;
55 numeric endtime, begintime, cutmargin, scalevecs;
56 color planetcolor, sunposition, earthvelocity, refpoi, surfacevel;
57 color ua, ub, uc, ud, ue;
58 pair va, vb, vc, vd, ve;
59 cutmargin = 0.01;
60 scalevecs = 1.3;
61 planetcolor = 0.3*(255,152,55)/255;
62 sunposition = red;
63 earthvelocity = green;
64 surfacevel = eulerrotation( 0, 0, 23, earthvelocity );
65 refpoi = 1.1*sunposition;
66 planet = rigorousfearpath( black, radius );
67 twilight = spatialhalfcircle( black, sunposition, radius+cutmargin, true );
68 endtime = xpart ( planet intersectiontimes twilight );
69 begintime = xpart ( reverse planet intersectiontimes twilight );
70 shadowplanet = subpath (-begintime-cutmargin,endtime+cutmargin) of planet;
71 fullplanet = buildcycle( shadowplanet, reverse twilight );
72 fill fullplanet withcolor planetcolor;
73 tdcircarrow( black, earthaxis, 1.1, 0, 90 );
74 % tdcircarrow( black, earthaxis, 1.1, 90, -90 );
75 ua = refpoi+scalevecs*earthaxis;
76 ub = refpoi+scalevecs*surfacevel;
77 uc = refpoi-scalevecs*earthaxis;
78 ud = refpoi-scalevecs*surfacevel;
79 ue = 2.2*earthvelocity;
80 tdarrow( 1.05*earthvelocity, ue );
81 tdarrow( refpoi, uc );
82 tdarrow( refpoi, ud );
83 tdarrow( refpoi, ub );
84 tdarrow( refpoi, ua );
85 va = rp( ua );
86 vb = rp( ub );
87 vc = rp( uc );
88 vd = rp( ud );
89 ve = rp( ue );
90 label.top( btex $\vec{A}$ etex, va );
91 label.rt( btex $\vec{B}$ etex, vb );
92 label.bot( btex $\vec{C}$ etex, vc );
93 label.lft( btex $\vec{D}$ etex, vd );
94 label.rt( btex $\vec{E}$ etex, ve );
95 endfig;
96
97 verbatimtex \end{document} etex
98
99 end.