summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/acmaglev.mp
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/metapost/featpost/example/acmaglev.mp')
-rw-r--r--Master/texmf-dist/doc/metapost/featpost/example/acmaglev.mp38
1 files changed, 38 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/featpost/example/acmaglev.mp b/Master/texmf-dist/doc/metapost/featpost/example/acmaglev.mp
new file mode 100644
index 00000000000..37cad98514f
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/featpost/example/acmaglev.mp
@@ -0,0 +1,38 @@
+% acmaglev.mp
+% L. Nobre G.
+% IYP (2005)
+
+input featpost3Dplus2D;
+
+Spread := 25;
+f := (0,-2,0);
+ParallelProj := true;
+ShiftV := ( 0, 1 );
+
+def vecfunc( expr posit )=
+ begingroup
+ save a, c, field;
+ color field;
+ numeric a, c;
+ a = (sind(X(posit))-Z(posit)*0.95)/40;
+ c = -Y( posit ) ;
+ field = ( 1, c, a );
+ ( field )
+ endgroup
+enddef;
+
+beginfig(1);
+ numeric i, tot;
+ path dephased, sinusoid, zeroaxis;
+ transform T;
+ tot = 900;
+ T = identity yscaled 2 xscaled 1/36 shifted (0,Shifts);
+ zeroaxis = rp( black )--rp( (tot,0,0) );
+ draw zeroaxis transformed T withcolor green;
+ sinusoid = rp( black ) for i=1 upto tot: ...rp( (i,0,sind(i)) ) endfor;
+ draw sinusoid transformed T;
+ dephased = fieldlinepath(tot,(0,0,1),1,vecfunc);
+ draw dephased transformed T withcolor red;
+endfig;
+
+end.