summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-coil/pst-coil.tex
blob: 077c71d5885d01c5c615a8a5b755e3c84afdb95a (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
%% BEGIN pst-coil.tex
%%
%% Coils and zigzags with PSTricks
%% See the PSTricks User's Guide for documentation.
%% For use with the PostScript header file `pst-coil.pro'.
%%
%%
%% COPYRIGHT 1993, 1994, 1999 by Timothy Van Zandt, tvz@nwu.edu.
%%           2006-2010 Herbert Voss, hvoss@tug.org
%%
%% 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.
%%
\message{ v\fileversion, \filedate}
\csname PSTcoilsLoaded\endcsname
\let\PSTcoilsLoaded\endinput
\ifx\PSTricksLoaded\endinput\else
\def\next{\input pstricks.tex}\expandafter\next
\fi
\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi
%
\def\fileversion{1.01}
\def\filedate{2010/01/30}
%
\edef\TheAtCode{\the\catcode`\@}
\catcode`\@=11
%
\pst@addfams{pst-coil}
\pstheader{pst-coil.pro}
\edef\pst@theheaders{\pst@theheaders,pst-coil.pro}
\def\pst@coildict{tx@CoilDict begin }
%
\define@key[psset]{pst-coil}{coilwidth}[1cm]{\pst@getlength{#1}\psk@coilwidth}
\define@key[psset]{pst-coil}{coilheight}[1]{\pst@checknum{#1}\pscoilheight}
\define@key[psset]{pst-coil}{coilarmA}[0.5cm]{\pst@getlength{#1}\psk@coilarmA}
\define@key[psset]{pst-coil}{coilarmB}[0.5cm]{\pst@getlength{#1}\psk@coilarmB}
\define@key[psset]{pst-coil}{coilarm}[0.5cm]{%
  \pst@getlength{#1}\psk@coilarmA%
  \let\psk@coilarmB\psk@coilarmA}
\define@key[psset]{pst-coil}{coilaspect}[45]{\pst@getangle{#1}\psk@coilaspect}
\define@key[psset]{pst-coil}{coilinc}[10]{\pst@getangle{#1}\psk@coilinc}
%
\psset[pst-coil]{coilaspect=45,coilarm=.5cm,coilheight=1,coilwidth=1cm,coilinc=10}
%
\def\pscoil{\def\pst@par{}\pst@object{pscoil}}
\def\pscoil@i{\pst@getarrows\pscoil@ii}
\def\pscoil@ii(#1){\@ifnextchar({\pscoil@iii{1}(#1)}{\pscoil@iii{\z@}(0,0)(#1)}}
\def\pscoil@iii#1(#2)(#3){%
  \begin@OpenObj
  \pst@getcoor{#2}\pst@tempa
  \pst@getcoor{#3}\pst@tempb
  \pst@optcp{#1}\pst@tempa
  \addto@pscode{%
    \pst@tempa \pst@tempb
    \psk@coilwidth \pscoilheight
    \psk@coilarmA \psk@coilarmB
    \psk@coilaspect \psk@coilinc
    \pst@coildict \tx@Coil end }%
    \showpointsfalse
  \end@OpenObj}
%
\define@key[psset]{pst-coil}{frequency}[1]{\def\psk@frequency{#1 }}
\define@key[psset]{pst-coil}{amplitude}[1]{\def\psk@amplitude{#1 }}
\define@key[psset]{pst-coil}{ppoints}[360]{\def\psk@ppoints{#1 }}
\define@key[psset]{pst-coil}{function}[sin]{\def\psk@function{#1 }}
\psset[pst-coil]{frequency=1,amplitude=1,ppoints=360,function=sin}
%
\def\tx@Sin{Sin }
%
\def\pssin{\pst@object{pssin}}
\def\pssin@i{\pst@getarrows\pssin@ii}
\def\pssin@ii(#1){\@ifnextchar({\pssin@iii{1}(#1)}{\pssin@iii{\z@}(0,0)(#1)}}
\def\pssin@iii#1(#2)(#3){%
  \begin@OpenObj
  \pst@getcoor{#2}\pst@tempa
  \pst@getcoor{#3}\pst@tempb
  \pst@optcp{#1}\pst@tempa
  \addto@pscode{%
    \pst@tempa \pst@tempb
    \psk@frequency \psk@amplitude \pst@number\psyunit mul
    \psk@coilarmA \psk@coilarmB 
    \psk@ppoints
    { \psk@function }
    \pst@coildict \tx@Sin end 
  }%
  \showpointsfalse%
  \end@OpenObj}
%
\def\tx@CoilLoop{CoilLoop }
\def\tx@Coil{Coil }
\def\psCoil{\def\pst@par{}\pst@object{psCoil}}
\def\psCoil@i#1#2{%
  \begin@AltOpenObj
  \showpointsfalse
  \pst@getangle{#1}\pst@tempa
  \pst@getangle{#2}\pst@tempb
  \addto@pscode{%
    \pst@tempa
    \pst@tempb
    \psk@coilwidth
    \pscoilheight
    \psk@coilaspect
    \psk@coilinc
    \pst@coildict \tx@AltCoil end 
    \@nameuse{psls@\pslinestyle} }%
  \end@OpenObj}
\def\tx@AltCoil{AltCoil }
%
\def\pszigzag{\def\pst@par{}\pst@object{pszigzag}}
\def\pszigzag@i{\pst@getarrows\pszigzag@ii}
\def\pszigzag@ii(#1){\@ifnextchar({\pszigzag@iii{1}(#1)}{\pszigzag@iii{\z@}(0,0)(#1)}}
\def\pszigzag@iii#1(#2)(#3){%
  \begin@OpenObj
  \pst@getcoor{#2}\pst@tempa
  \pst@getcoor{#3}\pst@tempb
  \pst@optcp{#1}\pst@tempa
  \addto@pscode{%
    \pst@tempa
    \pst@tempb
    \pscoilheight
    \psk@coilwidth
    \psk@coilarmA
    \psk@coilarmB
    \pst@coildict \tx@ZigZag end
    \psline@iii
    \tx@Line }%
  \end@OpenObj}
%
\def\tx@ZigZag{ZigZag }
%
\def\nccoil{\pst@object{nccoil}}
\def\nccoil@i{\check@arrow{\nccoil@ii}}
\def\nccoil@ii#1#2{\nc@object{Open}{#1}{#2}{.5}{%
  \tx@NCCoor
  tx@Dict begin
% DG/SR modification begin - Mar. 19, 1998 - Patch 2
  4 2 roll
% DG/SR modification end
  \psk@coilwidth \pscoilheight
  \psk@coilarmA \psk@coilarmB
  \psk@coilaspect \psk@coilinc
  \pst@coildict \tx@Coil end
  end }}
%
\def\pccoil{\def\pst@par{}\pst@object{pccoil}}
\def\pccoil@i{\pc@object\nccoil@ii}
\def\nczigzag{\pst@object{nczigzag}}
\def\nczigzag@i{\check@arrow{\nczigzag@ii}}
\def\nczigzag@ii#1#2{\nc@object{Open}{#1}{#2}{.5}{%
  \tx@NCCoor
  tx@Dict begin
% DG/SR modification begin - Mar. 19, 1998 - Patch 2
  4 2 roll
% DG/SR modification end
  \pscoilheight
  \psk@coilwidth
  \psk@coilarmA
  \psk@coilarmB
  \pst@coildict \tx@ZigZag end
  \psline@iii
  \tx@Line
  end }}
%
\def\pczigzag{\def\pst@par{}\pst@object{pczigzag}}
\def\pczigzag@i{\pc@object\nczigzag@ii}
%
\def\ncsin{\pst@object{ncsin}}
\def\ncsin@i{\check@arrow{\ncsin@ii}}
\def\ncsin@ii#1#2{\nc@object{Open}{#1}{#2}{.5}{%
  \tx@NCCoor
  tx@Dict begin
  4 2 roll
  \psk@frequency \psk@amplitude \pst@number\psyunit mul
  \psk@coilarmA \psk@coilarmB 
  \psk@ppoints
  { \psk@function }
  \pst@coildict \tx@Sin end
  end }}
%
\def\pcsin{\def\pst@par{}\pst@object{pcsin}}
\def\pcsin@i{\pc@object\ncsin@ii}
%
\catcode`\@=\TheAtCode\relax
\endinput
%%
%% END pst-coil.tex