| 1 |
% gausslawframe.mp |
| 2 |
% adapted from an ANEEMATE example |
| 3 |
% L. Nobre G. |
| 4 |
% IYP (2005) |
| 5 |
|
| 6 |
input featpost3Dplus2D; |
| 7 |
|
| 8 |
numeric ParameterA, ParameterB, ParameterC, ParameterD, ParameterE; |
| 9 |
ParameterA = 0; % |
| 10 |
ParameterB = 0.02; % escala geral |
| 11 |
ParameterC = 0.8; % avanco da superficie |
| 12 |
ParameterD = 1; % deslocamento do viewcentr |
| 13 |
ParameterE = 3.1; % capitulo |
| 14 |
|
| 15 |
verbatimtex |
| 16 |
\documentclass{article} |
| 17 |
\usepackage{mathpazo} |
| 18 |
\newfont{\featfont}{logod10 scaled 500} |
| 19 |
\begin{document} |
| 20 |
etex |
| 21 |
|
| 22 |
def sfsur( expr H, V ) = |
| 23 |
( (cosd(H)*cosd(V),sind(H)*cosd(V),sind(V)) ) |
| 24 |
enddef; |
| 25 |
|
| 26 |
primarydef a joi b = a & "," & b enddef; |
| 27 |
primarydef a empstr b = a & ditto & ditto & b enddef; |
| 28 |
|
| 29 |
beginfig(1); |
| 30 |
color auxb, auxc, pa, pb, pc, pd; |
| 31 |
numeric aux, i, j, cou, lim, max, numc, numofdiarr, radratio; |
| 32 |
numeric astepv, asteph, radiub, arch, starter, coverlim, fieldlen; |
| 33 |
numeric refav, refah, actad, minad, actav, actah, cop, lscale, maxlscale; |
| 34 |
pen thickp; |
| 35 |
string a, b, auxs; |
| 36 |
picture AM, DPHI; |
| 37 |
path p[]; |
| 38 |
pair auxp, lasp, lpoi, lvec;; |
| 39 |
f := (2,3.5,4.6); |
| 40 |
Spread := ParameterB[9,880]; |
| 41 |
fieldlen = 0.95; |
| 42 |
radius = 1; |
| 43 |
radratio = 3.5; |
| 44 |
numc = 9; |
| 45 |
numofdiarr = 120; |
| 46 |
refah = 50; |
| 47 |
refav = 30; |
| 48 |
actad = ((refav+90)/180) ++ (refah/180); |
| 49 |
minad = actad; |
| 50 |
actah = refah; |
| 51 |
actav = refav; |
| 52 |
cop = 0; |
| 53 |
thickp = pencircle scaled (ParameterB[0.2mm,1.2mm]); |
| 54 |
maxlscale = 3; |
| 55 |
lscale = ParameterB[1,maxlscale]; |
| 56 |
max = ceiling( radratio*numc*0.5 ); |
| 57 |
astepv = 180/max; |
| 58 |
radiub = radius*radratio; |
| 59 |
arch = radiub*astepv; |
| 60 |
coverlim = ParameterC[3*astepv-90,89]; |
| 61 |
viewcentr := ParameterD[black,0.5*(radiub+fieldlen)*sfsur(actah,actav)]; |
| 62 |
pickup thickp; |
| 63 |
getready( "tropicalglobe( numc, black, radius, blue );", black ); |
| 64 |
TDAtiplen := 0.15; |
| 65 |
TDAhalftipbase := 0.06; |
| 66 |
TDAhalfthick := 0.03; |
| 67 |
cou = 0; |
| 68 |
for j=1.5*astepv-90 step astepv until coverlim: |
| 69 |
asteph := arch/(radiub*cosd(j-0.5*astepv)); |
| 70 |
lim := ceiling(360/asteph); |
| 71 |
asteph := 360/lim; |
| 72 |
starter := uniformdeviate( asteph ); |
| 73 |
for i=starter-180 step asteph until 180: |
| 74 |
cou := incr( cou ); |
| 75 |
pa := radiub*sfsur(i-asteph,j-astepv); |
| 76 |
pb := radiub*sfsur(i,j-astepv); |
| 77 |
pc := radiub*sfsur(i,j); |
| 78 |
pd := radiub*sfsur(i-asteph,j); |
| 79 |
actad := ((i-0.5*asteph-refah)/180) ++ ((j-0.5*astepv-refav)/180); |
| 80 |
if actad < minad: |
| 81 |
minad := actad; |
| 82 |
actav := j-0.5*astepv; |
| 83 |
actah := i-0.5*asteph; |
| 84 |
cop := cou; |
| 85 |
fi; |
| 86 |
auxc := radiub*sfsur( i-0.5*asteph, j-0.5*astepv ); |
| 87 |
p[cou] = rp(pa)--rp(pb)--rp(pc)--rp(pd)--cycle; |
| 88 |
auxs := decimal( cou ); |
| 89 |
getready( "unfill p" & auxs & "; draw p" & auxs & ";", auxc ); |
| 90 |
a := cstr( auxc ); |
| 91 |
b := cstr( auxc+fieldlen*N(auxc) ); |
| 92 |
getready( "tdarrow(" & a joi b & ");", 1.1*auxc ); |
| 93 |
endfor; |
| 94 |
endfor; |
| 95 |
doitnow; |
| 96 |
draw VGAborder; |
| 97 |
AM = btex {\featfont ANEEMATE} etex; |
| 98 |
label.ulft( AM rotated 90, point 1 of VGAborder); |
| 99 |
unfill p[cop]; |
| 100 |
draw p[cop]; |
| 101 |
auxb := radiub*sfsur(actah,actav); |
| 102 |
auxc := (radiub+fieldlen)*sfsur(actah,actav); |
| 103 |
tdarrow( auxb, auxc ); |
| 104 |
drawoptions( withcolor blue ); |
| 105 |
label.lft( btex $\vec{E}$ etex scaled lscale, rp( auxc ) ); |
| 106 |
drawoptions( withpen thickp withcolor red ); |
| 107 |
auxc := (radiub+0.5*fieldlen)*sfsur(actah,actav); |
| 108 |
drawarrow rp(auxb)--rp(auxc); |
| 109 |
label.rt( btex $d\vec{A}$ etex scaled lscale, rp( auxc ) ); |
| 110 |
drawoptions( withcolor blue ); |
| 111 |
if (ParameterE>0.5) and (ParameterE<1.5): |
| 112 |
DPHI = btex $d\Phi=\vec{E}\cdot d\vec{A} = E\,dA$ etex scaled maxlscale; |
| 113 |
label.lrt( DPHI, point 3 of VGAborder); |
| 114 |
fi; |
| 115 |
if (ParameterE>1.5) and (ParameterE<3.5): |
| 116 |
DPHI = btex $\Phi=\int d\Phi |
| 117 |
=\int \vec{E}\cdot d\vec{A} |
| 118 |
=\int E\,dA |
| 119 |
=E\int dA |
| 120 |
=4\pi R^2 E |
| 121 |
=\frac{Q}{\mathcal{E}_0} |
| 122 |
\Leftrightarrow |
| 123 |
E= \frac{Q}{4\pi R^2\mathcal{E}_0}$ etex scaled maxlscale; |
| 124 |
auxp = ( lrcorner DPHI ) - ( llcorner DPHI ); |
| 125 |
lasp = ( point 3 of VGAborder ) + auxp; |
| 126 |
lvec = lasp - ( point 2 of VGAborder ); |
| 127 |
lpoi = ( point 3 of VGAborder ) - (ParameterE-2)*lvec; |
| 128 |
label.lrt( DPHI, lpoi ); |
| 129 |
fi; |
| 130 |
|
| 131 |
produce_vga_border; |
| 132 |
endfig; |
| 133 |
|
| 134 |
verbatimtex |
| 135 |
\end{document} |
| 136 |
etex |
| 137 |
|
| 138 |
end; |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|