| 1 |
% redplanet.mp |
| 2 |
% L. Nobre G. |
| 3 |
% 2006 |
| 4 |
|
| 5 |
input featpost3Dplus2D; |
| 6 |
|
| 7 |
f := (4,0,-1); |
| 8 |
def cf( expr Pair ) = |
| 9 |
begingroup |
| 10 |
save xc, yc, xa, ya; |
| 11 |
numeric xc, yc, xa, ya; |
| 12 |
xc = xpart Pair; |
| 13 |
yc = ypart Pair; |
| 14 |
xa = 1.25*(xc+1); |
| 15 |
ya = 1.25*(yc+1); |
| 16 |
( rp( ( cosd(ya)*cosd(xa), cosd(ya)*sind(xa), sind(ya) ) ) ) |
| 17 |
endgroup |
| 18 |
enddef; |
| 19 |
|
| 20 |
beginfig(1); |
| 21 |
numeric u; |
| 22 |
color yellow, thered, theblue; |
| 23 |
path martelo, foice, monitor, ecran, mar, foi, rotfoi, rotmar, pa, pb, pc; |
| 24 |
u = 1pt; |
| 25 |
yellow = 0.87*(0.95*red+0.7*green); |
| 26 |
thered = 0.66red; |
| 27 |
theblue= 0.87*(0.95*blue+0.27*red); |
| 28 |
|
| 29 |
numeric cabosal, cabesal, cabolar, cabelar; |
| 30 |
numeric cabolen, cabeclen, cabecontrol, martelrot; |
| 31 |
pair martelpos; |
| 32 |
cabosal = 2u; |
| 33 |
cabesal = 6u; |
| 34 |
cabolar = 8u; |
| 35 |
cabelar = 10u; |
| 36 |
cabolen = 70u; |
| 37 |
cabeclen = 7u; |
| 38 |
cabecontrol = 4u; |
| 39 |
martelrot = 50; |
| 40 |
martelpos = dir(180)*0.03*cabolen; |
| 41 |
z100 = origin; |
| 42 |
z101 = ( cabesal, 0 ); |
| 43 |
z102 = ( cabesal, cabosal+cabelar-cabolen ); |
| 44 |
z103 = ( cabesal+cabolar, cabosal+cabelar-cabolen ); |
| 45 |
z104 = ( cabesal+cabolar, 0 ); |
| 46 |
z105 = ( cabesal+cabolar+cabeclen, 0 ); |
| 47 |
z106 = ( cabesal+cabolar+cabecontrol, cabelar ); |
| 48 |
z107 = ( cabesal+cabolar, cabelar ); |
| 49 |
z108 = ( cabesal+cabolar, cabelar+cabosal ); |
| 50 |
z109 = ( cabesal, cabelar+cabosal ); |
| 51 |
z110 = ( cabesal, cabelar ); |
| 52 |
z111 = ( 0, cabelar ); |
| 53 |
martelo = z100-- |
| 54 |
z101-- |
| 55 |
z102-- |
| 56 |
z103-- |
| 57 |
z104-- |
| 58 |
z105..controls z106 and 0.5[z106,z107].. |
| 59 |
z107-- |
| 60 |
z108-- |
| 61 |
z109-- |
| 62 |
z110-- |
| 63 |
z111--cycle; |
| 64 |
mar = martelo rotated martelrot shifted martelpos; |
| 65 |
|
| 66 |
numeric fcabolen, fcabolar, foicecontrol, laminang; |
| 67 |
numeric foicerot, foicaber, flamilar, fcabomar, refang; |
| 68 |
numeric fmaomarg, fmaorais, fmaospac, fprotrud, basangul; |
| 69 |
pair foicepos; |
| 70 |
laminang = 9; |
| 71 |
refang = 10; |
| 72 |
basangul = 23; |
| 73 |
fcabomar = 3u; |
| 74 |
fcabolar = 8u - fcabomar; |
| 75 |
flamilar = 4u; |
| 76 |
fcabolen = 22u; |
| 77 |
foicecontrol = 2u; |
| 78 |
fmaomarg = 6u; |
| 79 |
fmaorais = 2u; |
| 80 |
fmaospac = 14u; |
| 81 |
fprotrud = 25u; |
| 82 |
foicaber = 42u; |
| 83 |
foicerot = -50; |
| 84 |
foicepos = dir(270)*0.325*foicaber; |
| 85 |
z200 = origin; |
| 86 |
z201 = ( -fcabomar, 0 ); |
| 87 |
z202 = ( -fcabomar, -fcabolen ); |
| 88 |
z203 = ( fcabolar, -fcabolen ); |
| 89 |
z204 = ( fcabolar+foicecontrol, -fcabolen ); |
| 90 |
z205 = ( fcabolar+fmaomarg, fmaorais-fmaospac ); |
| 91 |
z206 = ( fcabolar, -fmaospac ); |
| 92 |
z207 = ( fcabolar, 0 ); |
| 93 |
z208 = ( -fprotrud, foicaber ); |
| 94 |
z209 = ( 0, flamilar ); |
| 95 |
foice = z200-- |
| 96 |
z201-- |
| 97 |
z202-- |
| 98 |
z203..controls z204 and 0.5[z204,z205].. |
| 99 |
z205{dir(-160)}..{left} |
| 100 |
z206-- |
| 101 |
z207{dir(basangul)}..tension 0.8..{dir(180+refang+laminang)} |
| 102 |
z208{dir(refang-laminang)}..tension 0.8..{dir(180+basangul)} |
| 103 |
z209--cycle; |
| 104 |
% draw foice; |
| 105 |
% dotlabels.top(203,204,205); |
| 106 |
foi = foice rotated foicerot shifted foicepos; |
| 107 |
|
| 108 |
numeric l, k; |
| 109 |
% k = length foi; |
| 110 |
% l = length mar; |
| 111 |
% show (k,l); |
| 112 |
rotfoi = startahead( foi, 6 ); |
| 113 |
rotmar = startahead( mar, 1 ); |
| 114 |
% drawarrow subpath (0,1) of rotfoi withpen pencircle scaled 1pt withcolor red; |
| 115 |
% drawarrow subpath (0,1) of rotmar withpen pencircle scaled 1pt withcolor red; |
| 116 |
|
| 117 |
fill rigorousfearpath( black, 1 ) withcolor thered; |
| 118 |
pa = crossingline(rotfoi,rotmar,0.001); |
| 119 |
pb = closedpathinspace( pa, 16, cf ); |
| 120 |
pc = closedpathinspace( lasermachine(pa,3pt,0.3), 16, cf ); |
| 121 |
fill pc withcolor theblue; |
| 122 |
fill pb withcolor yellow; |
| 123 |
|
| 124 |
% fill rotfoi withcolor yellow+thered; |
| 125 |
% fill rotmar withcolor 0.7blue; |
| 126 |
|
| 127 |
produce_auto_scale; |
| 128 |
|
| 129 |
% for l=0 step 15 until 360: |
| 130 |
% show angle(dir(l)); |
| 131 |
% endfor; |
| 132 |
endfig; |
| 133 |
|
| 134 |
|
| 135 |
end; |
| 136 |
|
| 137 |
|