| 1 |
% gnupost3Dlogo.mp |
| 2 |
% 2006 |
| 3 |
% L. Nobre G. |
| 4 |
|
| 5 |
input featpost3Dplus2D; |
| 6 |
|
| 7 |
% bash: export TEX=latex |
| 8 |
% tcsh: setenv TEX latex |
| 9 |
|
| 10 |
prologues := 1; |
| 11 |
|
| 12 |
def converterfunc( expr Pair ) = |
| 13 |
begingroup |
| 14 |
save factconv, angstart, ystart, cx, cy, raux, aaux, xaux, yaux, zaux; |
| 15 |
numeric factconv, angstart, ystart, cx, cy, raux, aaux, xaux, yaux, zaux; |
| 16 |
save overtang, factang; |
| 17 |
numeric overtang, factang; |
| 18 |
ystart = 2; |
| 19 |
factconv = 0.0046; |
| 20 |
angstart = 70; |
| 21 |
overtang = 55; |
| 22 |
factang = 12; |
| 23 |
cx = factconv*(ypart Pair); |
| 24 |
cy = ystart+factconv*(xpart Pair); |
| 25 |
raux = cy*sind(overtang); |
| 26 |
aaux = angstart-factang*factconv*(xpart Pair)-(180/3.14159)*cx/raux; |
| 27 |
zaux = cy*cosd(overtang); |
| 28 |
yaux = raux*sind(aaux); |
| 29 |
xaux = raux*cosd(aaux); |
| 30 |
( rp( ( xaux, yaux, zaux ) ) ) |
| 31 |
endgroup |
| 32 |
enddef; |
| 33 |
|
| 34 |
beginfig(1); |
| 35 |
numeric u, nstripes, aspecratio, minskip, maxskip, shiftlim, shiftmin; |
| 36 |
numeric nbreaks, i, j, ymax, shiftx, lefh, righ, actualx, newx; |
| 37 |
numeric prevlefh, prevrigh, xmax, auxan, auxr, cdiam; |
| 38 |
path lefp[], rigp[], strp[], backpath; |
| 39 |
pair shif, reflef, refrig, auxa, auxb; |
| 40 |
boolean exitcondition; |
| 41 |
u = 1cm; |
| 42 |
nstripes = 7; |
| 43 |
aspecratio = 1.7; |
| 44 |
minskip = 0.5u; % must not be too small |
| 45 |
maxskip = 4u; |
| 46 |
shiftlim = 0.7u; |
| 47 |
shiftmin = 0.25u; |
| 48 |
cdiam = 0.65u; |
| 49 |
xmax = (2*nstripes-1)*u; |
| 50 |
ymax = aspecratio*xmax; |
| 51 |
backpath = origin--(0,xmax)--(ymax,xmax)--(ymax,0)--cycle; |
| 52 |
prevlefh = ymax; |
| 53 |
prevrigh = ymax; |
| 54 |
actualx = u; |
| 55 |
for i=1 upto nstripes: |
| 56 |
lefp[i] = ((2*i-1)*u,ymax); |
| 57 |
rigp[i] = ((2*i-1)*u,ymax)--(2*i*u,ymax); |
| 58 |
endfor; |
| 59 |
exitcondition = false; |
| 60 |
forever: |
| 61 |
auxr := uniformdeviate(2)-1; |
| 62 |
if auxr > 0: |
| 63 |
newx := actualx + shiftmin + (shiftlim-shiftmin)*auxr; |
| 64 |
else: |
| 65 |
newx := actualx - shiftmin + (shiftlim-shiftmin)*auxr; |
| 66 |
fi; |
| 67 |
lefh := prevlefh - minskip - uniformdeviate(maxskip-minskip); |
| 68 |
righ := prevrigh - minskip - uniformdeviate(maxskip-minskip); |
| 69 |
if lefh < minskip: |
| 70 |
lefh := minskip; |
| 71 |
exitcondition := true; |
| 72 |
fi; |
| 73 |
if righ < minskip: |
| 74 |
righ := minskip; |
| 75 |
exitcondition := true; |
| 76 |
fi; |
| 77 |
reflef := (newx,lefh); |
| 78 |
refrig := (newx+xmax,righ); |
| 79 |
auxan := angle(refrig-reflef); |
| 80 |
shif := (newx-actualx)*(1,sind(auxan)/cosd(auxan)); |
| 81 |
for i=1 upto nstripes: |
| 82 |
auxa := point (length lefp[i]) of lefp[i]; |
| 83 |
auxb := point (length rigp[i]) of rigp[i]; |
| 84 |
pair poil, poir; |
| 85 |
poil = auxa+whatever*down; |
| 86 |
poil = whatever[reflef,refrig]; |
| 87 |
poir = auxb+whatever*down; |
| 88 |
poir = whatever[reflef,refrig]; |
| 89 |
lefp[i] := lefp[i]--poil--(poil+shif); |
| 90 |
rigp[i] := rigp[i]--poir--(poir+shif); |
| 91 |
endfor; |
| 92 |
actualx := newx; |
| 93 |
prevlefh := lefh; |
| 94 |
prevrigh := righ; |
| 95 |
exitif exitcondition; |
| 96 |
endfor; |
| 97 |
for i=1 upto nstripes: |
| 98 |
auxa := point (length lefp[i]) of lefp[i]; |
| 99 |
auxb := point (length rigp[i]) of rigp[i]; |
| 100 |
pair poil, poir; |
| 101 |
poil = auxa+whatever*down; |
| 102 |
poil = whatever[origin,right]; |
| 103 |
poir = auxb+whatever*down; |
| 104 |
poir = whatever[origin,right]; |
| 105 |
lefp[i] := lefp[i]--poil--poir; |
| 106 |
rigp[i] := rigp[i]--poir; |
| 107 |
strp[i] = buildcycle( lefp[i], reverse rigp[i] ); |
| 108 |
endfor; |
| 109 |
fill backpath withcolor (0.55blue); |
| 110 |
for i=nstripes+1 upto nstripes+50: |
| 111 |
strp[i] = fullcircle scaled cdiam shifted |
| 112 |
(u+uniformdeviate(ymax-2u),u+uniformdeviate(xmax-2u)); |
| 113 |
fill strp[i]; |
| 114 |
endfor; |
| 115 |
ShiftV := (0.3*ymax,0); |
| 116 |
viewcentr := (0,0.7,1); |
| 117 |
f := (3,0,0); |
| 118 |
Spread := 70; |
| 119 |
for i=1 upto nstripes: |
| 120 |
fill closedpathinspace( strp[i], 8, converterfunc ) withcolor red; |
| 121 |
endfor; |
| 122 |
clip currentpicture to backpath; |
| 123 |
endfig; |
| 124 |
|
| 125 |
end. |