summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-12-03 16:47:39 +0000
committerKarl Berry <karl@freefriends.org>2011-12-03 16:47:39 +0000
commit97e4684a37e4899e8cdd42ab670b6e25dd319d1a (patch)
treebc263a56d75c177b79ae13c6e6ec7a3c30278dbf /Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp
parenta2c8654f8955a0d35c8b0c2d1752a506a426681b (diff)
featpost (17nov11)
git-svn-id: svn://tug.org/texlive/trunk@24738 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp')
-rw-r--r--Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp102
1 files changed, 102 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp b/Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp
new file mode 100644
index 00000000000..4e54429b3ed
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/featpost/example/fallinthewind.mp
@@ -0,0 +1,102 @@
+% fallinthewind.mp
+% L. Nobre G.
+% 2007
+
+input featpost3Dplus2D;
+
+Spread := 40;
+%f := 0.5[0.3*(15,10,5),0.3*(1.5,1,15)];
+f := 1.5*(2.5,1.7,1.5);
+viewcentr := (0,0,0.96);
+%show f;
+
+prologues := 1;
+
+color referencewind;
+numeric dragcoeff, horangle, quadcoef;
+horangle = 90;
+referencewind = red*cosd( horangle ) + green*sind( horangle );
+dragcoef = 0.045;
+quadcoef = 0.99;
+
+def vecfunc( expr posit, veloc )=
+ begingroup
+ save heig, wind, field, wint, blow;
+ color wind, field, blow;
+ numeric heig, wint;
+ heig = Z( posit );
+ wind = referencewind*quadcoef*(( heig+0.0001 )**2);
+ wind := wind-veloc;
+ wint = conorm( wind );
+ blow = N( wind );
+ field = dragcoef*blow*wint-blue;
+ ( field )
+ endgroup
+enddef;
+
+beginfig(1);
+ numeric i, numa, sa, ea, diffstep, ray;
+ color stp, svl, arrbe, arren;
+ path oneline;
+ pen grossa, fina;
+ arrbe = (0,-5,1);
+ arren = (0,-3,1);
+ TDAtiplen := 0.5;
+ TDAhalftipbase := 0.2;
+ TDAhalfthick := 0.1;
+ grossa = pencircle scaled 3pt;
+ fina = pencircle scaled 2pt;
+ diffstep = 0.03;
+ ray = 2.2;
+% numa = 0.02;
+% sa = 106.4;
+% ea = 106.6;
+ numa = 2;
+ sa = 80.5;
+ ea = 130.5;
+ setthestage( 20, 10 );
+ for i=sa step numa until ea:
+ stp := black;
+ svl := ray*(green*cosd(i)+blue*sind(i));
+ oneline := dragtrajectorypath( stp, svl, diffstep, vecfunc );
+ draw oneline;
+% draw oneline withpen fina withcolor background;
+ endfor;
+ tdarrow( arrbe, arren );
+ produce_vga_border;
+endfig;
+
+ray := 3.25;
+numeric min, rst;
+min = 0.5;
+rst = 0.1;
+for i=min step rst until ray:
+ %show i;
+ numeric xa, xb, xc, fa, fb, fc;
+ xa = 85;
+ svl := i*(green*cosd(xa)+blue*sind(xa));
+ oneline := dragtrajectorypath( black, svl, diffstep, vecfunc );
+ fa = PrintStep;
+ xb = 89;
+ svl := i*(green*cosd(xb)+blue*sind(xb));
+ oneline := dragtrajectorypath( black, svl, diffstep, vecfunc );
+ fb = PrintStep;
+ xc = 0;
+ forever:
+ exitif ( abs( fb - fa ) < 0.005 );
+ xc := xb - fb*(xb-xa)/(fb-fa);
+ svl := i*(green*cosd(xc)+blue*sind(xc));
+ oneline := dragtrajectorypath( black, svl, diffstep, vecfunc );
+ fc := PrintStep;
+ exitif ( abs( fc - fa ) < 0.0005 );
+ xa := xb;
+ fa := fb;
+ xb := xc;
+ fb := fc;
+ endfor;
+ message decimal( i ) & " " & decimal( xc );
+endfor;
+message " ";
+
+end.
+