| 1 |
% acmaglev.mp |
| 2 |
% L. Nobre G. |
| 3 |
% IYP (2005) |
| 4 |
|
| 5 |
input featpost3Dplus2D; |
| 6 |
|
| 7 |
Spread := 25; |
| 8 |
f := (0,-2,0); |
| 9 |
ParallelProj := true; |
| 10 |
ShiftV := ( 0, 1 ); |
| 11 |
|
| 12 |
def vecfunc( expr posit )= |
| 13 |
begingroup |
| 14 |
save a, c, field; |
| 15 |
color field; |
| 16 |
numeric a, c; |
| 17 |
a = (sind(X(posit))-Z(posit)*0.95)/40; |
| 18 |
c = -Y( posit ) ; |
| 19 |
field = ( 1, c, a ); |
| 20 |
( field ) |
| 21 |
endgroup |
| 22 |
enddef; |
| 23 |
|
| 24 |
beginfig(1); |
| 25 |
numeric i, tot; |
| 26 |
path dephased, sinusoid, zeroaxis; |
| 27 |
transform T; |
| 28 |
tot = 900; |
| 29 |
T = identity yscaled 2 xscaled 1/36 shifted (0,Shifts); |
| 30 |
zeroaxis = rp( black )--rp( (tot,0,0) ); |
| 31 |
draw zeroaxis transformed T withcolor green; |
| 32 |
sinusoid = rp( black ) for i=1 upto tot: ...rp( (i,0,sind(i)) ) endfor; |
| 33 |
draw sinusoid transformed T; |
| 34 |
dephased = fieldlinepath(tot,(0,0,1),1,vecfunc); |
| 35 |
draw dephased transformed T withcolor red; |
| 36 |
endfig; |
| 37 |
|
| 38 |
end. |