summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/repeated/nemdirector.mp
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/metapost/featpost/example/repeated/nemdirector.mp')
-rw-r--r--Master/texmf-dist/doc/metapost/featpost/example/repeated/nemdirector.mp82
1 files changed, 82 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/featpost/example/repeated/nemdirector.mp b/Master/texmf-dist/doc/metapost/featpost/example/repeated/nemdirector.mp
new file mode 100644
index 00000000000..4c1d88fe095
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/featpost/example/repeated/nemdirector.mp
@@ -0,0 +1,82 @@
+% nemdirector.mp
+% L. Nobre G.
+% 2003
+
+%input featpost3Dplus2D;
+
+verbatimtex
+\documentclass{article}
+%\usepackage{mathpazo}
+\begin{document}
+etex
+
+beginfig(1);
+ f := 2*(5,3,4);
+ Spread := 70;
+
+ numeric cylength, cyradius, zoneradi, zoneleng;
+ numeric i, angsdev, halfnum, directlen, arrthick;
+ numeric vcx, vcy, vcz, xcurr, ycurr, thickfact;
+ numeric atwo, zcurr, aone, apos;
+ color lenvec, currpos, tippos;
+ path arrpath;
+ picture tmppict;
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Nu
+ cylength := 0.45;
+ cyradius := 0.1;
+ zoneradi := 2;
+ zoneleng := 4;
+ directlen := 5.6;
+ angsdev := 12;
+ halfnum := 130;
+ thickfact := 5;
+ arrthick := Spread*ps( (0,0,0), thickfact );
+ tippos := (0,0,0.5*directlen);
+ arrpath := rp(-tippos)--rp(tippos);
+ ahlength := 3*arrthick;
+ ahangle := 40;
+ for i=1 upto halfnum:
+ zcurr := -0.5*zoneleng+uniformdeviate( zoneleng );
+ apos := uniformdeviate( 180 );
+ xcurr := -zoneradi*cosd( apos )*uniformdeviate( 1 );
+ ycurr := zoneradi*sind( apos )*uniformdeviate( 1 );
+ aone := uniformdeviate( 360 );
+ atwo := angsdev*normaldeviate;
+ vcz := cosd( atwo );
+ vcy := sind( atwo )*sind( aone );
+ vcx := sind( atwo )*cosd( aone );
+ currpos := ( xcurr, ycurr, zcurr );
+ lenvec := cylength*( vcx, vcy, vcz );
+ generatedirline( i, aone, 90-atwo, cylength, currpos );
+ endfor;
+ NL:= halfnum;
+ director_invisible( true, thickfact, false );
+ drawarrow arrpath withpen pencircle scaled arrthick;
+ for i=1 upto halfnum:
+ zcurr := -0.5*zoneleng+uniformdeviate( zoneleng );
+ apos := uniformdeviate( 180 );
+ xcurr := zoneradi*cosd( apos )*uniformdeviate( 1 );
+ ycurr := zoneradi*sind( apos )*uniformdeviate( 1 );
+ aone := uniformdeviate( 360 );
+ atwo := angsdev*normaldeviate;
+ vcz := cosd( atwo );
+ vcy := sind( atwo )*sind( aone );
+ vcx := sind( atwo )*cosd( aone );
+ currpos := ( xcurr, ycurr, zcurr );
+ lenvec := cylength*( vcx, vcy, vcz );
+ generatedirline( i, aone, 90-atwo, cylength, currpos );
+ endfor;
+ NL:= halfnum;
+ director_invisible( true, thickfact, false );
+ label.ulft(btex $\vec{n}$ etex scaled 8.5 rotated 90, rp(tippos) );
+ tmppict := currentpicture rotated -90;
+ currentpicture := nullpicture;
+ draw tmppict;
+endfig;
+
+verbatimtex
+\end{document}
+etex
+
+end;