| 1 |
% nemdirector.mp |
| 2 |
% L. Nobre G. |
| 3 |
% 2013 |
| 4 |
|
| 5 |
input featpost3Dplus2D; |
| 6 |
|
| 7 |
verbatimtex |
| 8 |
\documentclass{article} |
| 9 |
\usepackage{lucidabr} |
| 10 |
\begin{document} |
| 11 |
etex |
| 12 |
|
| 13 |
beginfig(1); |
| 14 |
f := 2*(5,3,4); |
| 15 |
Spread := 70; |
| 16 |
|
| 17 |
numeric cylength, cyradius, zoneradi, zoneleng; |
| 18 |
numeric i, angsdev, halfnum, directlen, arrthick; |
| 19 |
numeric vcx, vcy, vcz, xcurr, ycurr, thickfact; |
| 20 |
numeric atwo, zcurr, aone, apos, anul; |
| 21 |
color lenvec, currpos, tippos; |
| 22 |
path arrpath; |
| 23 |
picture tmppict; |
| 24 |
anul := 0; |
| 25 |
angsdev := 7; |
| 26 |
cylength := 0.45; |
| 27 |
cyradius := 0.1; |
| 28 |
zoneradi := 2; |
| 29 |
zoneleng := 4; |
| 30 |
directlen := 5.6; |
| 31 |
halfnum := 130; |
| 32 |
thickfact := 5; |
| 33 |
arrthick := Spread*ps( (0,0,0), thickfact ); |
| 34 |
tippos := (0,0,0.5*directlen); |
| 35 |
arrpath := rp(-tippos)--rp(tippos); |
| 36 |
ahlength := 3*arrthick; |
| 37 |
ahangle := 40; |
| 38 |
for i=1 upto halfnum: |
| 39 |
zcurr := -0.5*zoneleng+uniformdeviate( zoneleng ); |
| 40 |
apos := uniformdeviate( 180 ); |
| 41 |
xcurr := -zoneradi*cosd( apos )*uniformdeviate( 1 ); |
| 42 |
ycurr := zoneradi*sind( apos )*uniformdeviate( 1 ); |
| 43 |
aone := uniformdeviate( 360 ); |
| 44 |
atwo := anul+angsdev*normaldeviate; |
| 45 |
vcz := cosd( atwo ); |
| 46 |
vcy := sind( atwo )*sind( aone ); |
| 47 |
vcx := sind( atwo )*cosd( aone ); |
| 48 |
currpos := ( xcurr, ycurr, zcurr ); |
| 49 |
lenvec := cylength*( vcx, vcy, vcz ); |
| 50 |
generatedirline( i, aone, 90-atwo, cylength, currpos ); |
| 51 |
endfor; |
| 52 |
NL:= halfnum; |
| 53 |
director_invisible( true, thickfact, false ); |
| 54 |
drawarrow arrpath withpen pencircle scaled arrthick; |
| 55 |
for i=1 upto halfnum: |
| 56 |
zcurr := -0.5*zoneleng+uniformdeviate( zoneleng ); |
| 57 |
apos := uniformdeviate( 180 ); |
| 58 |
xcurr := zoneradi*cosd( apos )*uniformdeviate( 1 ); |
| 59 |
ycurr := zoneradi*sind( apos )*uniformdeviate( 1 ); |
| 60 |
aone := uniformdeviate( 360 ); |
| 61 |
atwo := anul+angsdev*normaldeviate; |
| 62 |
vcz := cosd( atwo ); |
| 63 |
vcy := sind( atwo )*sind( aone ); |
| 64 |
vcx := sind( atwo )*cosd( aone ); |
| 65 |
currpos := ( xcurr, ycurr, zcurr ); |
| 66 |
lenvec := cylength*( vcx, vcy, vcz ); |
| 67 |
generatedirline( i, aone, 90-atwo, cylength, currpos ); |
| 68 |
endfor; |
| 69 |
NL:= halfnum; |
| 70 |
director_invisible( true, thickfact, false ); |
| 71 |
label.urt(btex $\vec{n}$ etex scaled 8.5, rp(tippos) ); |
| 72 |
% label.ulft(btex $\vec{n}$ etex scaled 8.5 rotated 90, rp(tippos) ); |
| 73 |
% tmppict := currentpicture rotated -90; |
| 74 |
% currentpicture := nullpicture; |
| 75 |
% draw tmppict; |
| 76 |
endfig; |
| 77 |
|
| 78 |
verbatimtex |
| 79 |
\end{document} |
| 80 |
etex |
| 81 |
|
| 82 |
end; |