summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-electricfield/pst-electricfield.tex
blob: 05b38d8a6e7d0f2f35da820f92046fe94c71726c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
% $Id: pst-electricfield.tex 479 2011-03-26 10:12:49Z herbert $
%% Package `pst-electricfield.tex'
%%
%% Manuel Luque
%% Jürgen Gilg
%% Patrice Megret
%% Herbert Voß
%%
%% This program can be redistributed and/or modified under
%% the terms of the LaTeX Project Public License Distributed
%% from CTAN archives in directory macros/latex/base/lppl.txt.
%%
%% A PSTricks related package to draw electric field lines
%% It uses the method from Euler
%%
\csname PSTElectricFieldLoaded\endcsname
\let\PSTElectricFieldLoaded\endinput
%
% Requires some packages
\ifx\PSTricksLoaded\endinput\else \input pstricks   \fi
\ifx\MultidoLoaded\endinput\else  \input multido.tex\fi
\ifx\PSTXKeyLoaded\endinput\else  \input pst-xkey   \fi
%
\def\fileversion{0.14}
\def\filedate{2011/03/26}
\message{`pst-electricfield' v\fileversion, \filedate\space (ml,jg,hv)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
%
\SpecialCoor
\pst@addfams{pst-electricfield}

%% prologue for postcript
\pstheader{pst-electricfield.pro}%

%% [q1 x1 y1 N1 plotCharge] [q2 x2 y2 N2 plotCharge] [...] etc
%% [charge, coordonnees, nombre de lignes, plotCircle]
%% number of lines and boolean for the circle are optional 
\define@key[psset]{pst-electricfield}{Q}[{[1 -2 0 10][1 1 0][1 0 1 15]}]{\def\psk@electricfieldQ{#1}}
\psset[pst-electricfield]{Q=[1 -2 0 10][1 1 0][1 0 1 15]}
\define@key[psset]{pst-electricfield}{N}[17]{\def\psk@electricfieldN{#1 }} %% par defaut 16 lignes
\psset[pst-electricfield]{N=17}
%% nombre de points du trace
\define@key[psset]{pst-electricfield}{points}[400]{\def\psk@electricfieldpoints{#1 }}
\psset[pst-electricfield]{points=400}
%% pas du trace
\define@key[psset]{pst-electricfield}{Pas}[0.025]{\def\psk@electricfieldPas{#1 }}
\psset[pst-electricfield]{Pas=0.025}
\define@key[psset]{pst-electricfield}{posArrow}[0.25]{\def\psk@ElectricFieldposArrow{#1 }}
\psset[pst-electricfield]{posArrow=0.25}
%
\def\tx@EFieldDict{ tx@EFieldDict begin }
%
\def\psElectricfield{\pst@object{psElectricfield}}
\def\psElectricfield@i{%
  \pst@killglue%
  \addbefore@par{radius=1mm}%
  \begin@OpenObj%
  \pssetlength\pst@dimb\psk@radius
  \addto@pscode{%
    \tx@EFieldDict
    /QXYN [\psk@electricfieldQ] def
    /ChargeRadius \pst@number\pst@dimb def
    /N \psk@electricfieldN def
    /NbrePoints \psk@electricfieldpoints def
    /Pas \psk@electricfieldPas def
    /posArrow \psk@ElectricFieldposArrow def
    /arrowscale { \psk@arrowscale } def
    /xUnit \pst@number\psxunit def
    /yUnit \pst@number\psyunit def
    Electricfield
    end
 }%
  \end@OpenObj%
  \ignorespaces}

\define@key[psset]{pst-electricfield}{Vmax}[10]{\def\psk@electricfieldVmax{#1 }}
\psset[pst-electricfield]{Vmax=10}
\define@key[psset]{pst-electricfield}{Vmin}[-10]{\def\psk@electricfieldVmin{#1 }}
\psset[pst-electricfield]{Vmin=-10}
\define@key[psset]{pst-electricfield}{stepV}[2]{\def\psk@electricfieldStepV{#1 }}
\psset[pst-electricfield]{stepV=2}
\define@key[psset]{pst-electricfield}{stepFactor}[0.67]{\def\psk@electricfieldStepFactor{#1 }}
\psset[pst-electricfield]{stepFactor=0.67}
%
\def\psEquipotential{\pst@object{psEquipotential}}
\def\psEquipotential@i(#1,#2)(#3,#4){%
  \pst@killglue%
  \addbefore@par{radius=1mm}%
  \begin@OpenObj%
  \pssetlength\pst@dimb\psk@radius
  \addto@pscode{%
   \tx@EFieldDict
   /QXYN [\psk@electricfieldQ] def
   /ChargeRadius \pst@number\pst@dimb def
   /N \psk@electricfieldN def
   /NbrePoints \psk@electricfieldpoints def
   /Vmax \psk@electricfieldVmax def
   /Vmin \psk@electricfieldVmin def
   /StepV \psk@electricfieldStepV def
   /StepFactor \psk@electricfieldStepFactor def
   /posArrow \psk@ElectricFieldposArrow def
   /arrowscale { \psk@arrowscale } def
   /xUnit \pst@number\psxunit def
   /yUnit \pst@number\psyunit def
   /LW \pst@number\pslinewidth def
   /xMin #1 def
   /xMax #3 def
   /yMin #2 def
   /yMax #4 def
   Equipotential
   end
  }%
\end@OpenObj%
  \ignorespaces}
\catcode`\@=\PstAtCode\relax
%% END
\endinput