| 1 |
% cellevolve.mp |
| 2 |
% L. Nobre G. |
| 3 |
% IYP (2005) |
| 4 |
|
| 5 |
def projectyz( expr theta, phi ) = |
| 6 |
(cosd(theta)*sind(phi),sind(theta)) |
| 7 |
enddef; |
| 8 |
|
| 9 |
def rotatangl( expr ori, rang ) = |
| 10 |
( (xpart ori)*cosd(rang)-(ypart ori)*sind(rang), |
| 11 |
(xpart ori)*sind(rang)+(ypart ori)*cosd(rang)) |
| 12 |
enddef; |
| 13 |
|
| 14 |
numeric vertn, horin, grids, thex, they, varx, xcomp; |
| 15 |
numeric ymax, xmax, i, j, size, u, ycomp, theta, phi; |
| 16 |
numeric power, xlim, ylim, frac, vary, allang, shift; |
| 17 |
numeric perang, ampper, npers, velang, displamp, hdk; |
| 18 |
pair actpos, direct, one, two, displvec; |
| 19 |
path cirma, VGAborder; |
| 20 |
color thedark; |
| 21 |
|
| 22 |
u := 0.5mm; |
| 23 |
allang := 15; |
| 24 |
ampper := 20; |
| 25 |
npers := 4; |
| 26 |
velang := 5; |
| 27 |
hdk := 0.6; |
| 28 |
displamp := 8u; |
| 29 |
frac := 1.5; |
| 30 |
power := 0.8; |
| 31 |
vertn := 20; |
| 32 |
horin := 41; |
| 33 |
size := 3u; |
| 34 |
grids := 8u; |
| 35 |
ymax := floor(0.5*(vertn*frac-1)); |
| 36 |
xmax := floor(0.5*(horin*frac-1)); |
| 37 |
xlim := grids*0.5*horin; |
| 38 |
ylim := grids*0.5*vertn; |
| 39 |
varx := 180/(0.5*(horin-1)); |
| 40 |
vary := 90/(0.5*(vertn-1)); |
| 41 |
cirma := fullcircle scaled (grids); |
| 42 |
|
| 43 |
VGAborder := (-xlim,-ylim)-- % |
| 44 |
( xlim,-ylim)-- % |
| 45 |
( xlim, ylim)-- % |
| 46 |
(-xlim, ylim)--cycle; % |
| 47 |
|
| 48 |
beginfig(0); |
| 49 |
pickup pencircle scaled u; |
| 50 |
for i=-xmax upto xmax: |
| 51 |
for j=-ymax upto ymax: |
| 52 |
actpos:=grids*rotatangl((i,j),allang); |
| 53 |
thex:=i*varx; |
| 54 |
they:=j*vary; |
| 55 |
theta:=90*cosd(they)*cosd(thex); |
| 56 |
phi:=60*sind(2*they)*sind(thex); |
| 57 |
perang := allang+ampper*sind(npers*they); |
| 58 |
direct:=rotatangl(projectyz(theta,phi),perang); |
| 59 |
displvec:=dir(velang)*displamp*cosd(npers*they); |
| 60 |
actpos := actpos+displvec; |
| 61 |
one:=actpos-size*direct; |
| 62 |
two:=actpos+size*direct; |
| 63 |
thedark := (1-hdk*(ypart direct))*white; |
| 64 |
fill cirma shifted actpos withcolor thedark; |
| 65 |
draw one--two; |
| 66 |
endfor; |
| 67 |
endfor; |
| 68 |
clip currentpicture to VGAborder; |
| 69 |
undraw VGAborder; |
| 70 |
endfig; |
| 71 |
|
| 72 |
end; |