| 1 |
% saturn.mp |
| 2 |
% L. Nobre G. |
| 3 |
% 2007 |
| 4 |
|
| 5 |
input featpost3Dplus2D; |
| 6 |
|
| 7 |
verbatimtex |
| 8 |
\documentclass{article} |
| 9 |
\usepackage{newcent} |
| 10 |
\pagestyle{empty} |
| 11 |
\begin{document} |
| 12 |
etex |
| 13 |
|
| 14 |
f := 2.5*(5,0,-1); |
| 15 |
Spread := 100; |
| 16 |
|
| 17 |
beginfig(1); |
| 18 |
path planet, twilight, darkness, ringins, ringout, shadein, shadout; |
| 19 |
path fullplanet, fullring, backdark, sunplanet, backring; |
| 20 |
path nearringout, nearringins, hdtv, darkplanet; |
| 21 |
numeric planetray, ringinsray, ringoutray, cutmargin, athmosray; |
| 22 |
color sunposition, axedirection, labelpos, darknesstart, darknessend; |
| 23 |
numeric inclinangle, labelray, begintime, endtime, colorfactor; |
| 24 |
color planetcolor, ringcolor, toptextcolor, deepskycolor, bottextcolor; |
| 25 |
picture storepicture; |
| 26 |
planetray = 1; |
| 27 |
ringinsray = 1.6; |
| 28 |
ringoutray = 2.3; |
| 29 |
labelray = 2.1; |
| 30 |
cutmargin = 0.01; |
| 31 |
inclinangle = 15; |
| 32 |
sunposition = (-7,15,4); |
| 33 |
colorfactor = 1.3; |
| 34 |
bboxmargin := 10mm; |
| 35 |
planetcolor = colorfactor*(255,152,55)/255; |
| 36 |
ringcolor = colorfactor*(221,57,199)/255; |
| 37 |
toptextcolor = colorfactor*(187,164,109)/255; |
| 38 |
deepskycolor = colorfactor*(11,18,84)/255; |
| 39 |
bottextcolor = colorfactor*(15,103,23)/255; |
| 40 |
viewcentr := (0,0.5[planetray,ringinsray],0); |
| 41 |
labelpos = (0,labelray,0); |
| 42 |
athmosray = planetray+cutmargin; |
| 43 |
axedirection = (0,-sind(inclinangle),cosd(inclinangle)); |
| 44 |
planet = rigorousfearpath( black, planetray ); |
| 45 |
twilight = spatialhalfcircle( black, sunposition, athmosray, true ); |
| 46 |
darknesstart = athmosray*ncrossprod( sunposition, axedirection ); |
| 47 |
darknessend = darknesstart - labelray*N( sunposition ); |
| 48 |
darkness = pathofstraightline( darknesstart, darknessend ); |
| 49 |
darknesstart := -darknesstart; |
| 50 |
darknessend := darknesstart - labelray*N( sunposition ); |
| 51 |
backdark = pathofstraightline( darknesstart, darknessend ); |
| 52 |
ringins = goodcirclepath( black, axedirection, ringinsray ); |
| 53 |
ringout = goodcirclepath( black, axedirection, ringoutray ); |
| 54 |
endtime = xpart ( planet intersectiontimes twilight ); |
| 55 |
begintime = xpart ( reverse planet intersectiontimes twilight ); |
| 56 |
sunplanet = subpath (-begintime-cutmargin,endtime+cutmargin) of planet; |
| 57 |
darkplanet = planet cutbefore twilight cutafter twilight; |
| 58 |
fullplanet = buildcycle( sunplanet, reverse twilight ); |
| 59 |
fill fullplanet withcolor planetcolor; |
| 60 |
endtime := xpart ( ringins intersectiontimes darkness ); |
| 61 |
begintime := xpart ( reverse ringins intersectiontimes sunplanet ); |
| 62 |
nearringins = subpath (-begintime-cutmargin,endtime+cutmargin) of ringins; |
| 63 |
endtime := xpart ( ringout intersectiontimes darkness ); |
| 64 |
begintime := xpart ( reverse ringout intersectiontimes sunplanet ); |
| 65 |
nearringout = subpath (-begintime-cutmargin,endtime+cutmargin) of ringout; |
| 66 |
backring = buildcycle( backdark, ringout, reverse darkplanet, reverse ringins ); |
| 67 |
fullring = buildcycle( nearringout, reverse darkness, reverse nearringins, sunplanet ); |
| 68 |
fill backring withcolor ringcolor; |
| 69 |
fill fullring withcolor ringcolor; |
| 70 |
picture thestatement; |
| 71 |
thestatement = thelabel( |
| 72 |
btex |
| 73 |
\begin{tabular}{c} |
| 74 |
\textbf{\textsf{{\Large T}$\!$ecnumbria}} \\ |
| 75 |
\textsf{\scriptsize a sombra da tecnologia} |
| 76 |
\end{tabular} |
| 77 |
etex, |
| 78 |
origin); |
| 79 |
pickup pencircle scaled 1pt; |
| 80 |
draw thestatement scaled 2 shifted rp(labelpos) withcolor toptextcolor; |
| 81 |
storepicture = currentpicture; |
| 82 |
z1 = lrcorner currentpicture; |
| 83 |
z2 = urcorner currentpicture; |
| 84 |
z3 = ulcorner currentpicture; |
| 85 |
z4 = llcorner currentpicture; |
| 86 |
z5 = z1+down*bboxmargin; |
| 87 |
z6 = z1+right*bboxmargin; |
| 88 |
z7 = z2+right*bboxmargin; |
| 89 |
z8 = z2+up*bboxmargin; |
| 90 |
z9 = z3+up*bboxmargin; |
| 91 |
z10= z3+left*bboxmargin; |
| 92 |
z11= z4+left*bboxmargin; |
| 93 |
z12= z4+down*bboxmargin; |
| 94 |
z13= 0.5[z5,z12]+down*3*bboxmargin; |
| 95 |
hdtv = z5..z6---z7..z8---z9..z10---z11..z12---cycle; |
| 96 |
message "Aspect ratio: " & decimal( (xpart (z7-z10))/(ypart (z8-z5)) ); |
| 97 |
numeric wid; |
| 98 |
wid = (xpart (z7-z10))/(1mm); |
| 99 |
message "Width: " & decimal( wid ) & "mm"; |
| 100 |
message "Resolution for MooMiniCard: " & decimal(1.9083*222/wid) & "*100dpi"; |
| 101 |
%% I don't know why there is need for the 1.9083 factor... |
| 102 |
fill hdtv withcolor deepskycolor; |
| 103 |
draw storepicture; |
| 104 |
% label(btex \texttt{\LARGE http://tecnumbria.com} etex, z13 ); |
| 105 |
endfig; |
| 106 |
|
| 107 |
% beginfig(2); |
| 108 |
% prologues := 1; |
| 109 |
% pickup pencircle scaled 9pt; |
| 110 |
% fill hdtv; |
| 111 |
% unfill fullplanet; |
| 112 |
% draw fullplanet; |
| 113 |
% unfill fullring; |
| 114 |
% draw fullring; |
| 115 |
% unfill backring; |
| 116 |
% draw backring; |
| 117 |
% endfig; |
| 118 |
|
| 119 |
% beginfig(3); |
| 120 |
% prologues := 1; |
| 121 |
% pickup pencircle scaled 0pt; |
| 122 |
% draw fullplanet withcolor red; |
| 123 |
% draw fullring withcolor green; |
| 124 |
% draw backring withcolor blue; |
| 125 |
% endfig; |
| 126 |
|
| 127 |
verbatimtex \end{document} etex |
| 128 |
|
| 129 |
end; |
| 130 |
|