Debian Codegraph @

texmf-dist/tex/generic/pstricks-add/pstricks-add.tex

raw
1 %% $Id: pstricks-add.tex 705 2023-04-17 18:32:58Z herbert $
2 %%
3 %% This is file `pstricks-add.tex',
4 %%
5 %% IMPORTANT NOTICE:
6 %%
7 %% Package `pstricks-add.tex'
8 %%
9 %% Dominique Rodriguez
10 %% Herbert Voss <[email protected]>
11 %% Michael Sharpe <[email protected]>
12 %%
13 %% This program can be redistributed and/or modified under the terms
14 %% of the LaTeX Project Public License Distributed from CTAN archives
15 %% in directory macros/latex/base/lppl.txt.
16 %%
17 %% DESCRIPTION:
18 %% `pstricks-add' is a PSTricks package for additionals to the standard
19 %% pstricks package
20 %%
21 \csname PSTricksAddLoaded\endcsname
22 \let\PSTricksAddLoaded\endinput
23 %
24 % Requires some packages
25 \ifx\PSTricksLoaded\endinput\else \input pstricks \fi
26 \ifx\PSTplotLoaded\endinput\else \input pst-plot \fi
27 \ifx\PSTnodesLoaded\endinput\else \input pst-node \fi
28 \ifx\PSTarrowLoaded\endinput\else \input pst-arrow \fi
29 \ifx\PSTthreeDLoaded\endinput\else\input pst-3d \fi
30 \ifx\MultidoLoaded\endinput\else \input multido \fi
31 \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi
32 \ifx\PSTmathLoaded\endinput\else \input pst-math \fi
33 %
34 \def\fileversion{3.94}
35 \def\filedate{2023/04/17}
36 \let\pstricksaddFV\fileversion
37 \message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)}
38 %
39 \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
40 \SpecialCoor
41 \pst@addfams{pstricks-add}
42 %
43 %% prologue for postcript
44 \pstheader{pstricks-add.pro}%
45 %
46 \def\psGetSlope(#1,#2)(#3,#4)#5{% 4 values without a dimen! #5 is a macro
47 \pst@dimm=#1pt%
48 \advance\pst@dimm by -#3pt%
49 \pst@dimn=#2pt%
50 \advance\pst@dimn by -#4pt
51 \pst@divide{\pst@dimn}{\pst@dimm}#5}
52 %
53 \def\psGetDistance{\@ifnextchar[\psGetDistance@i{\psGetDistance@ii}}
54 \def\psGetDistance@i[#1](#2,#3)(#4,#5)#6{% 4 values without a dimen! #6 is a macro
55 \if@pstLaTeX
56 \edef#6{\pscalculate{round(sqrt((#4-#2)^2+(#5-#3)^2),#1)}}%
57 \else
58 \pst@dimm=#1pt
59 \advance\pst@dimm by -#3pt
60 \pst@dimn=#2pt
61 \advance\pst@dimn by -#4pt
62 \pst@pyth\pst@dimm\pst@dimn\pst@dimo
63 \edef#5{\strip@pt\pst@dimo}%
64 \fi
65 }%
66 \def\psGetDistance@ii(#1,#2)(#3,#4)#5{% 4 values without a dimen! #6 is a macro
67 \if@pstLaTeX
68 \edef#5{\pscalculate{sqrt((#3-#1)^2+(#4-#2)^2)}}%
69 \else
70 \pst@dimm=#1pt
71 \advance\pst@dimm by -#3pt
72 \pst@dimn=#2pt
73 \advance\pst@dimn by -#4pt
74 \pst@pyth\pst@dimm\pst@dimn\pst@dimo
75 \edef#5{\strip@pt\pst@dimo}%
76 \fi
77 }%
78 %--------------------------------------- small stuff -------------------------------
79 \define@boolkey[psset]{pstricks-add}[Pst@]{CMYK}[true]{}
80 \psset[pstricks-add]{CMYK=true}
81 %
82 \def\defineTColor{\@ifnextchar[{\defineTColor@i}{\defineTColor@i[]}}
83 \def\defineTColor@i[#1]#2#3{% "semi transparency colors"
84 \def\pst@tempA{#1}%
85 \newpsstyle{#2}{%
86 fillstyle=vlines,hatchwidth=0.1\pslinewidth,
87 hatchsep=1\pslinewidth,hatchcolor=#3}%
88 \ifx\pst@tempA\@empty\else\psset{#1}\fi%
89 }
90 \defineTColor{TRed}{red}
91 \defineTColor{TGreen}{green}
92 \defineTColor{TBlue}{blue}
93 %
94 \def\rmultiput{\pst@object{rmultiput}}
95 \def\rmultiput@i#1{%
96 \pst@killglue%
97 \begingroup%
98 \use@par%
99 \@ifnextchar({\rmultiput@ii{#1}}{\rmultiput@ii{#1}(\z@,\z@)}}
100 \def\rmultiput@ii#1(#2){%
101 \if@star\rput*(#2){#1}\else\rput(#2){#1}\fi
102 \@ifnextchar({\rmultiput@ii{#1}}{\endgroup}}
103
104 % #1: (x,y) #2: rotAngle #3: object
105 \def\psrotate{\pst@object{psrotate}}
106 \def\psrotate@i(#1)#2{%
107 \pst@killglue
108 \begingroup%
109 \use@par\pst@makebox{\psrotate@ii(#1){#2}}}
110 \def\psrotate@ii(#1)#2{%
111 \pst@getcoor{#1}\pst@tempA
112 \pst@getangle{#2}\pst@tempB
113 \leavevmode
114 \pst@Verb{
115 gsave
116 { \pst@tempA /yRot ED /xRot ED
117 \pst@tempB dup cos /cosA ED sin /sinA ED
118 /ax cosA def
119 /by sinA def
120 /cx sinA neg def
121 /dy cosA def
122 /ex xRot cosA mul neg xRot add yRot sinA mul add def
123 /fy xRot sinA mul neg yRot add yRot cosA mul sub def
124 [ax by cx dy ex fy] concat } \tx@TMChange
125 }%
126 \box\pst@hbox
127 \pst@Verb{ \tx@TMRestore grestore }\endgroup
128 \ignorespaces}
129 %
130 % [#1]: obtargs; (#2,#3): center; {#4}: factor; {#5}: object
131 \def\psHomothetie{\def\pst@par{}\pst@object{psHomothetie}}
132 \def\psHomothetie@i(#1)#2{%
133 \begin@SpecialObj%
134 \pst@getcoor{#1}\pst@tempA% converts the coordinates without a unit into pt
135 \pst@makebox{\psHomothetie@ii{#2}}}% put the contents into a box
136 \def\psHomothetie@ii#1{%
137 \pst@Verb{%
138 { \pst@tempA /yH ED /xH ED
139 [#1 0 0 #1 #1 xH mul neg xH add #1 yH mul neg yH add] concat }
140 \tx@TMChange }%
141 \box\pst@hbox%
142 \pst@Verb{ \tx@TMRestore }%
143 \end@SpecialObj}
144 %
145 \define@key[psset]{pstricks-add}{intSeparator}{\def\psk@intSeparator{#1}}
146 \psset{intSeparator={,}}
147 %
148 \def\psFormatInt{\def\pst@par{}\pst@object{psFormatInt}}
149 \def\psFormatInt@i#1{{%
150 \pst@killglue
151 \use@par
152 \count1=#1\count2=\count1
153 \ifnum\count1=0 0\else
154 \ifnum\count1>999999
155 \count3=\count1
156 \divide\count3 by 1000000
157 \the\count3\psk@intSeparator\relax
158 \multiply\count3 by 1000000
159 \advance\count1 by -\count3 % modulo 1000000
160 \fi%
161 \ifnum\count2>999
162 \count3=\count1
163 \divide\count3 by 1000
164 \ifnum\count2>99999
165 \ifnum\count3<100 0\fi
166 \ifnum\count3<10 0\fi
167 \fi%
168 \the\count3\psk@intSeparator\relax
169 \multiply\count3 by 1000
170 \advance\count1 by -\count3 %modulo 1000
171 \fi%
172 \ifnum\count2>999
173 \ifnum\count1<100 0\fi
174 \ifnum\count1<10 0\fi
175 \fi%
176 \the\count1
177 \fi%
178 }\ignorespaces}
179 %
180 \define@key[psset]{pstricks-add}{braceWidth}{\pst@getlength{#1}\psk@braceWidth}
181 \define@key[psset]{pstricks-add}{bracePos}{\pst@checknum{#1}\psk@bracePos}
182 \define@key[psset]{pstricks-add}{braceWidthInner}{\pst@getlength{#1}\psk@braceWidthInner}
183 \define@key[psset]{pstricks-add}{braceWidthOuter}{\pst@getlength{#1}\psk@braceWidthOuter}
184 %
185 \define@boolkey[psset]{pstricks-add}[PST@]{singleline}[true]{}%use \ifPST@metricFunction
186 \psset{singleline=false}
187
188 \def\psbrace{\def\pst@par{}\pst@object{psbrace}}
189 \def\psbrace@i(#1)(#2)#3{%
190 \addbefore@par{ref=lb,linewidth=0.01pt,fillstyle=solid,fillcolor=black}% default setting
191 \begin@SpecialObj
192 \if@star\def\pst@tempC{true }\else\def\pst@tempC{false }\fi
193 \ifx\psk@rot\empty\def\psk@@rot{0}\else\let\psk@@rot\psk@rot\fi
194 \def\psk@rot{Alpha \psk@@rot\space add 90 sub}%
195 \pst@getcoor{#1}\pst@tempA
196 \pst@getcoor{#2}\pst@tempB
197 \rput(!
198 /ifStar \pst@tempC def
199 /radius1 \psk@braceWidthOuter def
200 /radius2 \psk@braceWidthInner def
201 /Alpha \pst@tempA \pst@tempB 3 -1 roll sub 3 1 roll exch sub atan def
202 gsave STV CP T /ps@rot \psk@rot\space def grestore
203 /Length \pst@tempA \pst@tempB Pyth2 def
204 /Left { Length \psk@bracePos\space mul } bind def
205 /Right { Length Left sub } bind def
206 /Width \psk@braceWidth def
207 /pop4 { pop pop pop pop } def
208 gsave
209 [ Alpha cos Alpha sin Alpha sin neg Alpha cos \pst@tempA ] concat
210 0 0 moveto
211 0 radius2 neg radius2 radius2 neg radius2 arcto pop4
212 Left radius2 sub radius1 sub 0 rlineto
213 Left radius2 neg Left radius2 radius1 add neg radius1 arcto pop4
214 currentpoint /y@Label ED /x@Label ED
215 Left radius2 neg Left radius1 add radius2 neg radius1 arcto pop4
216 Right radius2 sub radius1 sub 0 rlineto
217 Length radius2 neg Length 0 radius2 arcto pop4
218 \ifPST@singleline\else
219 % 0 Width neg rlineto
220 Length radius2 Width add neg Length radius2 sub radius2 Width add neg radius2 arcto pop4
221 Right radius2 sub radius1 sub neg 0 rlineto
222 Left radius1 add Width radius1 add radius2 add neg radius1 90 180 arc
223 Left radius1 sub Width radius1 add radius2 add neg radius1 0 90 arc
224 Left radius2 sub radius1 sub neg 0 rlineto
225 radius2 Width neg radius2 270 180 arcn
226 0 0 lineto
227 \ifx\psk@fillstyle\relax\else
228 gsave
229 ifStar { \pst@usecolor\pslinecolor }{ \pst@usecolor\psfillcolor } ifelse
230 fill
231 grestore
232 \fi
233 \fi
234 % \pst@number\pslinewidth setlinewidth \pst@usecolor\pslinecolor stroke
235 \ifx\pslinestyle\@none\else
236 \pst@number\pslinewidth SLW
237 \pst@usecolor\pslinecolor
238 \@nameuse{psls@\pslinestyle}
239 \tx@setStrokeTransparency
240 \fi
241 stroke
242 0 0 moveto
243 grestore
244 % now calculate the label pos
245 /Dh radius1 radius2 add Width add def
246 \pst@tempA \pst@tempB 3 -1 roll sub 3 1 roll exch sub % dy dx
247 \psk@bracePos\space mul exch \psk@bracePos\space mul % d'x d'y
248 \pst@tempA 3 -1 roll add Dh Alpha cos mul sub % d'x x yA
249 \psk@nodesepB sub % use minus sign to shidt right
250 3 1 roll add Dh Alpha sin mul add \psk@nodesepA add
251 exch \tx@UserCoor ){#3}
252 \end@SpecialObj}
253 %
254 \def\psBrace{\def\pst@par{}\pst@object{psBrace}}
255 \def\psBrace@i(#1)(#2){%
256 \begin@ClosedObj
257 \if@star\def\pst@tempC{true }\else\def\pst@tempC{false }\fi
258 % \ifx\psk@rot\empty\def\psk@@rot{0}\else\let\psk@@rot\psk@rot\fi
259 % \def\psk@rot{Alpha \psk@@rot\space add 90 sub}%
260 \pst@getcoor{#1}\pst@tempA
261 \pst@getcoor{#2}\pst@tempB
262 \addto@pscode{
263 /ifStar \pst@tempC def
264 /radius1 \psk@braceWidthOuter def
265 /radius2 \psk@braceWidthInner def
266 /Alpha \pst@tempA \pst@tempB 3 -1 roll sub 3 1 roll exch sub atan def
267 % gsave STV CP T /ps@rot \psk@rot\space def grestore
268 /Length \pst@tempA \pst@tempB Pyth2 def
269 /Left { Length \psk@bracePos\space mul } bind def
270 /Right { Length Left sub } bind def
271 /Width \psk@braceWidth def
272 /pop4 { pop pop pop pop } def
273 [ Alpha cos Alpha sin Alpha sin neg Alpha cos \pst@tempA ] concat
274 0 0 moveto
275 0 radius2 neg radius2 radius2 neg radius2 arcto pop4
276 Left radius2 sub radius1 sub 0 rlineto
277 Left radius2 neg Left radius2 radius1 add neg radius1 arcto pop4
278 currentpoint /y@Label ED /x@Label ED
279 Left radius2 neg Left radius1 add radius2 neg radius1 arcto pop4
280 Right radius2 sub radius1 sub 0 rlineto
281 Length radius2 neg Length 0 radius2 arcto pop4
282 % 0 Width neg rlineto
283 Length radius2 Width add neg Length radius2 sub radius2 Width add neg radius2 arcto pop4
284 Right radius2 sub radius1 sub neg 0 rlineto
285 Left radius1 add Width radius1 add radius2 add neg radius1 90 180 arc
286 Left radius1 sub Width radius1 add radius2 add neg radius1 0 90 arc
287 Left radius2 sub radius1 sub neg 0 rlineto
288 radius2 Width neg radius2 270 180 arcn
289 0 0 lineto }
290 \end@ClosedObj
291 \ignorespaces}
292 %
293 \newdimen\psparallelogramsep
294 \define@key[psset]{pstricks-add}{parallelogramsep}[3mm]{\pssetlength\psparallelogramsep{#1}}
295 \psset[pstricks-add]{parallelogramsep=3mm}
296 %
297 \def\psparallelogrambox{\pst@object{psparallelogrambox}}
298 \def\psparallelogrambox@i{\pst@makebox\psparallelogrambox@ii}
299 \def\psparallelogrambox@ii{%
300 \begingroup
301 \pst@useboxpar
302 \pst@dima=\pslinewidth
303 \advance\pst@dima by \psframesep
304 \pst@dimc=\wd\pst@hbox\advance\pst@dimc by \pst@dima
305 \pst@dimb=\dp\pst@hbox\advance\pst@dimb by \pst@dima
306 \pst@dimd=\ht\pst@hbox\advance\pst@dimd by \pst@dima
307 % Dirk Osburg modification begin - Jul. 16, 2011
308 \divide\psparallelogramsep by 2
309 \advance\pst@dima by \psparallelogramsep
310 \advance\pst@dimc by \psparallelogramsep
311 % Dirk Osburg modification end
312 \setbox\pst@hbox=\hbox{%
313 \ifpsboxsep\kern\pst@dima\fi
314 \begin@ClosedObj
315 \addto@pscode{%
316 \psk@cornersize
317 \pst@number\pst@dima neg % left
318 \pst@number\pst@dimb neg % lower
319 \pst@number\pst@dimc % right
320 \pst@number\pst@dimd % upper
321 .5
322 % D.G. modification begin - Nov. 28, 2001
323 %\tx@Frame}%
324 \pst@number\psparallelogramsep
325 \tx@Parallelogram}%
326 % D.G. modification end
327
328 \def\pst@linetype{2}%
329 \showpointsfalse
330 \end@ClosedObj
331 \box\pst@hbox
332 \ifpsboxsep\kern\pst@dima\fi%
333 }%
334 \ifpsboxsep\dp\pst@hbox=\pst@dimb\ht\pst@hbox=\pst@dimd\fi
335 \leavevmode\box\pst@hbox
336 \endgroup%
337 }
338
339 % From the Frame and Rect PostScript macros
340 \pst@def{Parallelogram}<{%
341 /ParallelogramA {
342 % Dirk Osburg modification begin - Jul. 16, 2011
343 %%%% old stuff: %%%
344 %x1 pgs sub y1 moveto
345 %x1 y2 lineto
346 %x2 pgs add y2 lineto
347 %x2 y1 lineto
348 %x1 pgs sub y1 lineto
349 %%%% replaced by: %%%
350 x1 pgs sub y1 moveto
351 x1 pgs add y2 lineto
352 x2 pgs add y2 lineto
353 x2 pgs sub y1 lineto
354 x1 pgs sub y1 lineto
355 % Dirk Osburg modification end
356 closepath} def
357 %
358 /pgs ED
359 CLW mul
360 /a ED
361 3 -1 roll
362 2 copy gt { exch } if
363 a sub
364 /y2 ED
365 a add
366 /y1 ED
367 2 copy gt { exch } if
368 a sub
369 /x2 ED
370 a add
371 /x1 ED
372 1 index 0 eq {pop pop ParallelogramA } { OvalFrame } ifelse}>
373 %
374 \def\parseRP#1;#2;#3\@nil{%check whether arg of refpt contains ;
375 \def\arg@A{#1}\def\arg@B{#2}}
376 %
377 \def\Put{\pst@object{Put}}%
378 \def\Put@i{\@ifnextchar({\Put@ii{}}{\Put@ii}}%
379 \def\Put@ii#1(#2)#3{{%
380 \pst@killglue
381 \use@par
382 \expandafter\parseRP#1;;\@nil%sets \arg@A, \arg@B
383 \ifx\arg@B\@empty% use \rput
384 \edef\arg@A{\if@star*\fi\ifx\arg@A\@empty\else[\arg@A]\fi}%
385 \expandafter\rput\arg@A(>#2){#3}
386 \else% use \uput
387 \edef\arg@A{\if@star*\fi%
388 \ifx\arg@A\@empty\else{\arg@A}\fi%
389 \ifx\arg@B\@empty[0]\else[\arg@B]\fi}%
390 \expandafter\uput\arg@A(>#2){#3}
391 \fi}\ignorespaces}%
392
393 % Modify pst@rot so that a rotation may be specified with a node or ps code
394 %
395 \define@key[psset]{pstricks-add}{Os}[0]{\def\PST@Os{#1}}
396 \psset{Os=0}%
397 \define@key[psset]{pstricks-add}{Ds}[1]{\def\PST@Ds{#1}}
398 \psset{Ds=1}%
399 \define@key[psset]{pstricks-add}{metricInitValue}[0]{\def\PST@metricInitValue{#1}}
400 \psset{metricInitValue=0}%
401 \define@boolkey[psset]{pstricks-add}[PST@]{metricFunction}[true]{}%use \ifPST@metricFunction
402 \psset{metricFunction=false}%
403 \def\pscurvepoints{\pst@object{pscurvepoints}}%
404 \def\pscurvepoints@i#1#2#3#4{{%optional [plotpoints=xx]
405 % #1=tmin,#2=tmax,#3=function (of t),#4=array root name,
406 \pst@killglue
407 \use@par
408 \edef\my@tempA{#3}% x(t) y(t) expanded
409 \expandafter\testAlg\my@tempA|\@nil%
410 \pst@Verb{ % so we can use definitions from tx@Dict
411 /unitratio \pst@number\psyunit \pst@number\psxunit div def
412 /unitratiosq unitratio dup mul def
413 /t0 #1 def
414 /t1 #2 def
415 t1 t0 sub \psk@plotpoints\space div /dt exch def }%
416 \pst@cntc=\psk@plotpoints\relax%\psk@plotpoints=plotpoints-1
417 \pst@cntb=\pst@cntc\relax%\psk@plotpoints=plotpoints-1
418 \advance\pst@cntc by \@ne\relax%=plotpoints
419 \ifx\my@tempD\@empty\pst@Verb{ /Func (#3) cvx def }%
420 \else\pst@Verb{ /Func (#3 ) AlgParser cvx def }%
421 \fi%
422 \pst@Verb{
423 /#4.X \the\pst@cntc\space array def
424 /#4.Y \the\pst@cntc\space array def %
425 /#4Delta.X \the\pst@cntc\space array def %
426 /#4Delta.Y \the\pst@cntc\space array def %
427 /#4Normal.X \the\pst@cntc\space array def %
428 /#4Normal.Y \the\pst@cntc\space array def %
429 /t #1 def Func 2 copy /priory ED /priorx ED #4.Y 0 3 -1 roll put #4.X 0 3 -1 roll put %
430 1 1 \the\pst@cntb\space { dup /j ED dt mul #1 add /t ED Func %x y on stack
431 2 copy priory sub dup #4Delta.Y j 3 -1 roll put % x y x y-priory
432 unitratiosq mul neg #4Normal.X j 3 -1 roll put % x y x
433 priorx sub dup #4Delta.X j 3 -1 roll put % x y x-priorx
434 #4Normal.Y j 3 -1 roll put % x y
435 2 copy /priory ED /priorx ED % x y
436 #4.Y j 3 -1 roll put #4.X j 3 -1 roll put } for %
437 }%
438 \expandafter\xdef \csname #4pointcount\endcsname {\psk@plotpoints}%
439 % \typeout{Created points #40 .. #4\psk@plotpoints}%
440 }\ignorespaces}%
441 %
442 %code to place ticks along polyline
443 \def\pspolylineticks{\pst@object{pspolylineticks}}%
444 \def\pspolylineticks@i#1{\@ifnextchar[{\pspolylineticks@ii{#1}}{\pspolylineticks@ii{#1}[]}}%
445 \newcount\pst@cntC%
446 \def\pspolylineticks@ii#1[#2]#3#4#5{{%
447 %#1= root name,#2=pscode (optional),#3=metric function,#4=first tick,#5=tick count
448 % Metric function may be a function of x, y (keyword metricFunction)
449 % or a function of x, y, dx, dy, ds requiring incremental build
450 \addbefore@par{arrows=-,linewidth=\psk@ytickwidth\pslinewidth}%
451 \use@par%
452 \pst@killglue%there's a leak that can occur here with ticksize--fixed in recent pstricks.tex
453 \pst@cntC=\expandafter\csname #1pointcount\endcsname\relax%
454 \pst@cntb=\pst@cntC\advance\pst@cntb\m@ne\relax%
455 \pst@cntd=\pst@cntC\advance\pst@cntd\@ne\relax%
456 \pst@Verb{ % so we can use definitions from tx@Dict in pstricks.pro
457 /TDict 20 dict def TDict begin %
458 /Func (#3) cvx def /sarray \the\pst@cntd\space array def %
459 #2
460 \ifPST@metricFunction
461 0 1 #1.X length 1 sub {
462 /j ED sarray j %
463 #1.X j get /x ED #1.Y j get /y ED Func put
464 } for %
465 \else %build by increments
466 sarray 0 \PST@metricInitValue\space put %
467 1 1 #1.X length 1 sub {
468 /j ED sarray j %
469 #1.X j 1 sub get
470 /x ED #1.Y j 1 sub get
471 /y ED #1Delta.X j get
472 /dx ED #1Delta.Y j get
473 /dy ED /ds dx dup mul dy dup mul add sqrt def %
474 Func sarray j 1 sub get add put
475 } for %
476 \fi %\ifPSTfunctionMetric
477 \ifnum\Pst@Debug>0
478 /str 10 string def
479 /tmpar [(Metric range: [) () (, ) () (])] def %
480 tmpar 1 sarray 0 get str cvs put
481 /str 10 string def
482 tmpar 3 sarray \the\pst@cntC\space get str cvs put tmpar
483 tx@NodeDict begin concatstringarray = end %
484 \fi % end debug
485 %compute ticks
486 /nl 0 def /nu \the\pst@cntC\space def
487 /smin sarray 0 get def
488 /smax sarray nu get def
489 /Os \ifx\PST@Os\@empty smin \else \PST@Os\space \fi def %
490 /Ds \ifx\PST@Ds\@empty smax Os sub 10 div \else \PST@Ds\space \fi def %
491 /scount smax Os sub Ds div cvi def %
492 /tarray scount 1 add array def %
493 /#1Tick.X scount 1 add array def %
494 /#1Tick.Y scount 1 add array def %
495 /#1TickN.X scount 1 add array def %
496 /#1TickN.Y scount 1 add array def %
497 0 1 scount { dup Ds mul Os add tarray 3 1 roll put } for %tick positions in tarray
498 % find the corresponding s values using binary search
499 0 1 scount {
500 dup tarray exch get /s exch def /j exch def %sought metric value,index
501 /m nl def /n nu def /k nl nu add 2 div cvi def 20 { s sarray k get lt { %
502 /n k def /k k m add 2 div cvi def }{ /m k def /nl k def /k k n add 2 div cvi def } ifelse %
503 n 1 sub m le { /nl m def exit } if } repeat %
504 sarray n get sarray m get dup 3 1 roll % sm sn sm
505 sub dup 0 le { pop pop 0 }{%sm sn-sm
506 exch %sn-sm sm
507 s sub neg exch div } ifelse % s->(s-sm)/(sn-sm)
508 dup #1Delta.X m 1 add get mul #1.X m get add #1Tick.X j 3 -1 roll put % s on stack
509 #1Delta.Y m 1 add get mul #1.Y m get add #1Tick.Y j 3 -1 roll put %
510 #1TickN.X j #1Normal.X m 1 add get put #1TickN.Y j #1Normal.Y m 1 add get put %
511 } for %
512 \ifnum\Pst@Debug>0
513 /tmpar 2 array def
514 /str 4 string def tmpar 0 (Created data for points #1Tick0..#1Tick) put
515 tmpar 1 scount str cvs put tmpar tx@NodeDict begin concatstringarray = end
516 \fi%
517 end }% end pst@Verb
518 %Draw ticks
519 \multido{\iA=#4+1}{#5}{%
520 \pnode(! TDict begin \iA\space scount gt
521 { 1 0 /VV ED /UU ED 0 0 }
522 { #1TickN.X \iA\space get #1TickN.Y \iA\space get /VV ED /UU ED #1Tick.X \iA\space get #1Tick.Y \iA\space get } ifelse
523 2 copy /YY ED /XX ED end){#1Tick\iA}%
524 \pnode(! TDict begin UU VV end ){#1Normal\iA}%
525 \pnode(! TDict begin VV UU neg unitratiosq div end ){#1Tangent\iA}%
526 \edef\cmd{\noexpand\psline(\the\pst@yticksizeA;{(! TDict begin UU VV end )})(\the\pst@yticksizeB;{(! TDict begin UU VV end )})}%
527 \pscustom{\translate(! TDict begin XX YY end)\cmd}}%
528 }\ignorespaces}%
529 %
530 \define@key[psset]{pstricks-add}{randomPoints}[1000]{\def\psk@randomPoints{#1}}
531 \define@key[psset]{pstricks-add}{randInit}[rrand]{\def\psk@randInit{#1 }}
532 \define@boolkey[psset]{pstricks-add}[Pst@]{color}[true]{}
533 \psset{randomPoints=1000,color=false,randInit}
534 %
535 \def\psRandom{\def\pst@par{}\pst@object{psRandom}}% hv 2004-11-12
536 \def\psRandom@i{\@ifnextchar({\psRandom@ii}{\psRandom@iii(0,0)(1,1)}}
537 \def\psRandom@ii(#1){\@ifnextchar({\psRandom@iii(#1)}{\psRandom@iii(0,0)(#1)}}
538 \def\psRandom@iii(#1)(#2)#3{%
539 \def\pst@tempA{#3}%
540 \ifx\pst@tempA\pst@empty\psclip{\psframe(#2)}\else\psclip{#3}\fi
541 \pst@getcoor{#1}\pst@tempA
542 \pst@getcoor{#2}\pst@tempB
543 \begin@SpecialObj
544 \addto@pscode{
545 \pst@tempA\space /yMin exch def
546 /xMin exch def
547 \pst@tempB\space /yMax exch def
548 /xMax exch def
549 /dy yMax yMin sub def
550 /dx xMax xMin sub def
551 \psk@randInit srand % initializes the random generator
552 /getRandReal { rand 2147483647 div } def
553 \psk@dotsize % defines /DS ... def
554 \@nameuse{psds@\psk@dotstyle}
555 \psk@randomPoints {
556 \ifPst@color getRandReal getRandReal getRandReal setrgbcolor \fi
557 getRandReal dx mul xMin add
558 getRandReal dy mul yMin add
559 Dot
560 \ifx\psk@fillstyle\psfs@solid fill \fi stroke
561 } repeat
562 }%
563 \end@SpecialObj
564 \endpsclip
565 \ignorespaces
566 }
567 %
568 \define@key[psset]{pstricks-add}{fillcolorA}[blue]{\pst@getcolor{#1}\psk@fillcolorA}
569 \define@key[psset]{pstricks-add}{fillcolorB}[red]{\pst@getcolor{#1}\psk@fillcolorB}
570 \define@boolkey[psset]{pstricks-add}[Pst@]{countDots}[true]{}
571 \psset[pstricks-add]{countDots=false,fillcolorA=blue,fillcolorB=red}
572 %
573 \def\psRandomPointArea{\pst@object{psRandomPointArea}}
574 \def\psRandomPointArea@i#1#2{%
575 \pst@killglue
576 \addbefore@par{radius=2pt,fillcolorA=blue,fillcolorB=red}%
577 \begin@SpecialObj
578 \pssetlength\pst@dimc{\psk@radius}
579 \addto@pscode{
580 realtime srand Rand pop
581 4 dict begin
582 /Func \ifPst@algebraic (#2) tx@addDict begin AlgParser end cvx \else { #2 } \fi def
583 1 1 #1 {
584 /i ED
585 Rand /x ED
586 Func /f ED % function value
587 Rand /y ED
588 gsave x y \tx@ScreenCoor \pst@number\pst@dimc 0 360 arc
589 y f lt { \pst@usecolor\psk@fillcolorA }{ \pst@usecolor\psk@fillcolorB } ifelse
590 fill grestore
591 \ifPst@countDots
592 x y \tx@ScreenCoor moveto i 4 string cvs
593 \ifpst@psfonts /Helvetica \else /NimbusSanL-Regu \fi
594 findfont 5 scalefont setfont show
595 \fi
596 } for
597 end
598 }%
599 \end@SpecialObj
600 \ignorespaces
601 }
602
603 %
604 \def\psComment{\def\pst@par{}\pst@object{psComment}}
605 \def\psComment@i{\pst@getarrows\psComment@ii}
606 \def\psComment@ii(#1)(#2)#3{\@ifnextchar[
607 {\psComment@iii(#1)(#2){#3}}
608 {\psComment@iii(#1)(#2){#3}[\ncline]}}
609 \def\psComment@iii(#1)(#2)#3[#4]{\@ifnextchar[
610 {\psComment@iv(#1)(#2){#3}[#4]}
611 {\psComment@iv(#1)(#2){#3}[#4][\rput]}}
612 \def\psComment@iv(#1)(#2)#3[#4][#5]{%
613 \pnode(#1){comment@1}
614 \pnode(#2){comment@2}
615 \ifx\relax#4\relax\let\pst@ConnectionCommand\ncline
616 \else\let\pst@ConnectionCommand#4\fi
617 \ifx\relax#5\relax\let\pst@PutCommand\rput
618 \else\let\pst@PutCommand#5\fi
619 \addbefore@par{npos=0}%
620 \begin@SpecialObj%
621 \pst@ConnectionCommand{comment@1}{comment@2}
622 \if@star\pst@PutCommand*(#1){#3}\else\pst@PutCommand(#1){#3}\fi
623 \end@SpecialObj%
624 \ignorespaces%
625 }
626 %
627 \define@key[psset]{pstricks-add}{tipAngle}[60]{\pst@getangle{#1}\psk@tipAngle}
628 \define@key[psset]{pstricks-add}{tipLength}[5mm]{\pst@getlength{#1}\psk@tipLength}
629 \define@key[psset]{pstricks-add}{tipWidth}[2mm]{\pst@getlength{#1}\psk@tipWidth}
630 \define@key[psset]{pstricks-add}{tipPos}[0.2]{\def\psk@tipPos{#1 }}
631 \psset[pstricks-add]{tipAngle=60,tipLength=5mm,tipWidth=2mm,tipPos=0.2}%
632 %
633 \def\psCallout{\def\pst@par{}\pst@object{psCallout}}
634 \def\psCallout@i(#1)#2{%
635 \setbox\pst@hbox=\hbox{#2}%
636 \begingroup
637 \addbefore@par{linewidth=0.1pt,framesep=6pt}%
638 \use@par
639 \pstVerb{
640 /boxsepX { \pst@number\psframesep\space \pst@number\psxunit div } bind def
641 /boxsepY { \pst@number\psframesep\space \pst@number\psyunit div } bind def
642 /tipEnd { \psk@tipLength\space \pst@number\psxunit div \psk@tipAngle\space PtoC } bind def
643 /boxW { \pst@number\wd\pst@hbox\space \pst@number\psxunit div boxsepX 2 mul add } bind def
644 /boxH { \pst@number\ht\pst@hbox\space \pst@number\psyunit div boxsepY 2 mul add } bind def
645 }%
646 \rput(#1){%
647 \psline[linearc=0,linejoin=2]%
648 (! tipEnd exch \psk@tipWidth\space 2 div \pst@number\psxunit div sub exch)%
649 (0,0)
650 (! tipEnd exch \psk@tipWidth\space 2 div \pst@number\psxunit div add exch)%
651 \psline[linejoin=2]%
652 (! tipEnd exch \psk@tipWidth\space 2 div \pst@number\psxunit div sub exch)%
653 (! tipEnd exch \psk@tipPos boxW mul sub exch)% lower left
654 (! tipEnd exch \psk@tipPos boxW mul sub exch boxH add )% upper left
655 (! tipEnd exch 1 \psk@tipPos sub boxW mul add exch boxH add)% upper right
656 (! tipEnd exch 1 \psk@tipPos sub boxW mul add exch)
657 (! tipEnd exch \psk@tipWidth\space 2 div \pst@number\psxunit div add exch)%
658 \rput[lb](! tipEnd boxsepY add exch \psk@tipPos boxW mul sub boxsepX add exch){#2}%
659 }%
660 \endgroup
661 \ignorespaces
662 }
663 %
664 \def\tx@MovetoByHand{ tx@addDict begin MovetoByHand end }
665 \def\tx@LinetoByHand{ tx@addDict begin LinetoByHand end }
666 %/amplHand {.8} def
667 %/dtHand 2 def
668
669 \def\pslineByHand{\def\pst@par{}\pst@object{pslineByHand}}
670 \def\pslineByHand@i{%
671 \addbefore@par{VarStepEpsilon=2,varsteptol=0.8}
672 \pst@getarrows{%
673 \begin@OpenObj
674 \pst@getcoors[\pslineByHand@ii}}
675 \def\pslineByHand@ii{%
676 \addto@pscode{
677 tx@addDict begin
678 /dtHand \psk@VarStepEpsilon\space def
679 /amplHand \psk@varsteptol\space def
680 % \pst@cp % current point
681 \tx@setlinejoin % hv 2007-10-13
682 MovetoByHand
683 counttomark 2 div /maxLines ED
684 1 1 maxLines { pop LinetoByHand } for
685 end
686 }%
687 \end@OpenObj%
688 }
689 %
690 \def\psRelLine{\def\pst@par{}\pst@object{psRelLine}}
691 \def\psRelLine@i{\@ifnextchar({\psRelLine@iii}{\psRelLine@ii}}
692 \def\psRelLine@ii#1{%
693 \addto@par{arrows=#1}%
694 \psRelLine@iii%
695 }
696 \def\psRelLine@iii(#1)(#2)#3#4{{
697 \pst@killglue
698 \use@par
699 \psRelNode(#1)(#2){#3}{#4}
700 \pcline(#1)(#4)%%%% \psline->\pcline 20140722
701 }\ignorespaces}
702 %
703 % #1 options
704 % draw a parallel line to #2 #3
705 % #2---------#3
706 % #4----------#5(new node)
707 % #5 length of the line
708 % #6 node name
709 \def\psParallelLine{\def\pst@par{}\pst@object{psParallelLine}}
710 \def\psParallelLine@i{\@ifnextchar({\psParallelLine@iii}{\psParallelLine@ii}}
711 \def\psParallelLine@ii#1{\addto@par{arrows=#1}\psParallelLine@iii}
712 \def\psParallelLine@iii(#1)(#2)(#3)#4#5{{
713 \pst@killglue
714 \use@par
715 \pst@getcoor{#1}\pst@tempA
716 \pst@getcoor{#2}\pst@tempB
717 \pst@getcoor{#3}\pst@tempC
718 % \pst@getlength{#4}\pst@dima
719 \pnode(!%
720 \pst@tempA /YA exch \pst@number\psyunit div def
721 /XA exch \pst@number\psxunit div def
722 \pst@tempB /YB exch \pst@number\psyunit div def
723 /XB exch \pst@number\psxunit div def
724 \pst@tempC /YC exch \pst@number\psyunit div def
725 /XC exch \pst@number\psxunit div def
726 %
727 /dx XB XA sub def
728 /dy YB YA sub def
729 /laenge dy dup mul dx dup mul add sqrt #4 mul def
730 /Alpha dy dx atan def
731 laenge Alpha cos mul XC add
732 laenge Alpha sin mul YC add ){#5}%
733 \pcline(#3)(#5)%%%% \psline->\pcline 20140722
734 }\ignorespaces
735 }
736 %
737 \define@key[psset]{pstricks-add}{startColor}[black]{\colorlet{tempcolor}[rgb]{#1}% we need rgb
738 \pst@getcolor{tempcolor}\ps@startColor}
739 \define@key[psset]{pstricks-add}{endColor}[white]{\colorlet{tempcolor}[rgb]{#1}%
740 \pst@getcolor{tempcolor}\ps@endColor}
741 \define@key[psset]{pstricks-add}{colorsteps}[256]{\pst@getint{#1}\pst@colorsteps}% hv 20211224
742 \psset[pstricks-add]{startColor=black,endColor=white,colorsteps=256}
743 %
744 \def\psColorLine{\def\pst@par{}\pst@object{psColorLine}}
745 \def\psColorLine@i{%
746 \pst@getarrows{%
747 \begin@OpenObj
748 \psColorLine@ii}%
749 }
750 \def\psColorLine@ii(#1){\@ifnextchar({\psColorLine@iii(#1)}{\psColorLine@iii(0,0)(#1)}}%
751 \def\psColorLine@iii(#1,#2)(#3,#4){%
752 % \use@par
753 \ifx\psk@arrowA\@empty\else\psline[linecolor=\ps@startColor]{->}(!#3 0.5 mul #4 0.5 mul)(#1,#2)\fi
754 \ifx\psk@arrowB\@empty\else\psline[linecolor=\ps@endColor]{->}(!#1 0.5 mul #2 0.5 mul)(#3,#4)\fi
755 \pst@getcoor{#1,#2}\pst@tempA
756 \pst@getcoor{#3,#4}\pst@tempB
757 \addto@pscode{
758 20 dict begin
759 [ \psgetRGBColorValues{\ps@startColor} ] aload length 1 eq { dup dup } if
760 3 copy 3 array astore /startColor ED
761 [ \psgetRGBColorValues{\ps@endColor} ] aload length 1 eq { dup dup } if
762 3 copy 3 array astore /endColor ED
763 % on stack R1 G1 B1 R2 G2 B2
764 4 -1 roll % R1 G1 R2 G2 B2 B1
765 sub \pst@colorsteps\space div /dB ED % R1 G1 R2 G2
766 3 -1 roll % R1 R2 G2 G1
767 sub \pst@colorsteps\space div /dG ED % R1 R2
768 exch sub \pst@colorsteps\space div /dR ED
769 \pst@tempB /Y2 ED /X2 ED
770 \pst@tempA /Y1 ED /X1 ED
771 Y2 Y1 sub X2 X1 sub atan /Angle ED
772 Y2 Y1 sub Angle sin dup 0 eq { pop }{ div } ifelse /L_line ED % line length
773 \ifx\psk@arrowA\@empty\else
774 X2 X1 sub L_line div \psk@arrowlength\space mul \pst@number\psxunit mul X1 add /X1 ED
775 Y2 Y1 sub L_line div \psk@arrowlength\space mul \pst@number\psyunit mul Y1 add /Y1 ED
776 \fi
777 \ifx\psk@arrowB\@empty\else
778 X2 X1 sub L_line div \psk@arrowlength\space mul \pst@number\psxunit mul X2 exch sub /X2 ED
779 Y2 Y1 sub L_line div \psk@arrowlength\space mul \pst@number\psyunit mul Y2 exch sub /Y2 ED
780 \fi
781 Y2 Y1 sub \pst@colorsteps\space 1 add div /dY ED
782 X2 X1 sub \pst@colorsteps\space 1 add div /dX ED
783 % dR dG dB == == ==
784 %startColor == endColor ==
785 \ifPst@noCurrentPoint\else\pst@cp\fi % current point?
786 0 1 \pst@colorsteps {
787 /dIndex ED
788 %startColor ==
789 X1 Y1 moveto
790 X1 dX add Y1 dY add % start for coordinate array
791 % gsave
792 lineto
793 CP /Y1 ED /X1 ED
794 \pst@number\pslinewidth SLW
795 startColor aload pop 3 copy setrgbcolor
796 % on stack r g b
797 dB add 3 1 roll % b+dB r g
798 dG add 3 1 roll % b+dB g+dG r
799 dR add 3 1 roll % b+dB g+dG r+dR
800 3 array astore /startColor ED
801 \tx@setStrokeTransparency
802 stroke
803 % grestore
804 } for
805 end % of local part
806 }%
807 \end@OpenObj
808 \ignorespaces
809 }
810 %
811 \def\psIntersectionPoint(#1)(#2)(#3)(#4)#5{%
812 \pst@getcoor{#1}\pst@tempA
813 \pst@getcoor{#2}\pst@tempB
814 \pst@getcoor{#3}\pst@tempC
815 \pst@getcoor{#4}\pst@tempd
816 \pnode(!%
817 \pst@tempA /YA exch \pst@number\psyunit div def
818 /XA exch \pst@number\psxunit div def
819 \pst@tempB /YB exch \pst@number\psyunit div def
820 /XB exch \pst@number\psxunit div def
821 \pst@tempC /YC exch \pst@number\psyunit div def
822 /XC exch \pst@number\psxunit div def
823 \pst@tempd /YD exch \pst@number\psyunit div def
824 /XD exch \pst@number\psxunit div def
825 /dY1 YB YA sub def
826 /dX1 XB XA sub def
827 /dY2 YD YC sub def
828 /dX2 XD XC sub def
829 dX1 abs 0.01 lt {
830 /m2 dY2 dX2 div def
831 XA dup XC sub m2 mul YC add
832 }{
833 dX2 abs 0.01 lt {
834 /m1 dY1 dX1 div def
835 XC dup XA sub m1 mul YA add
836 }{%
837 /m1 dY1 dX1 div def
838 /m2 dY2 dX2 div def
839 m1 XA mul m2 XC mul sub YA sub YC add m1 m2 sub div dup
840 XA sub m1 mul YA add
841 } ifelse
842 } ifelse ){#5}%
843 }
844 %
845 \def\psRiemannSum(#1,#2)#3#4{% (x0,x1) n f(#1)
846 \def\psFunction@##1{#4}%
847 \edef\ps@@dx{\pscalculate{(#2-#1)/#3}}%
848 \edef\ps@@dxHalf{\pscalculate{\ps@@dx/2}}%
849 % \typeout{dx=\ps@dx}%
850 \def\psRightSumValue{0}%
851 \def\psLeftSumValue{0}%
852 \def\psMiddleSumValue{0}%
853 \def\psDiffSumValue{0}%
854 \Multido{\rA=#1+\ps@@dx,\rB=\ps@@dx+\ps@@dx,\rC=\ps@@dxHalf+\ps@@dx}{#3}{%
855 \def\ps@rightY{\pscalculate{\psFunction@{\rB}}}%
856 \def\ps@leftY{\pscalculate{\psFunction@{\rA}}}%
857 \def\ps@middleY{\pscalculate{\psFunction@{\rC}}}%
858 % \typeout{\ps@leftY, \ps@rightY }%
859 \edef\psLeftSumValue{\pscalculate{\psLeftSumValue+\ps@@dx*\ps@leftY}}%
860 \edef\psRightSumValue{\pscalculate{\psRightSumValue+\ps@@dx*\ps@rightY}}%
861 \edef\psMiddleSumValue{\pscalculate{\psMiddleSumValue+\ps@@dx*\ps@middleY}}%
862 \edef\psDiffSumValue{\pscalculate{\psDiffSumValue+abs(\ps@@dx*(\ps@rightY-\ps@leftY))}}%
863 % \typeout{\psLeftSumValue , \psRightSumValue }%
864 }% end \Multido
865 }
866
867 %\define@key[psset]{pstricks-add}{method}{\def\psk@method{#1}}% defined in pst-plot
868 \define@key[psset]{pstricks-add}{whichabs}{\def\psk@whichabs{#1}}%
869 \define@key[psset]{pstricks-add}{whichord}{\def\psk@whichord{#1}}%
870 \define@key[psset]{pstricks-add}{plotfuncx}{\def\psk@plotfuncx{#1}}%
871 \define@key[psset]{pstricks-add}{plotfuncy}{\def\psk@plotfuncy{#1}}%
872 \define@key[psset]{pstricks-add}{expression}{\def\psk@expression{#1}}%
873 \define@boolkey[psset]{pstricks-add}[Pst@]{buildvector}[true]{}%
874 %
875 \define@key[psset]{pstricks-add}{varsteptol}{\def\psk@varsteptol{#1}}%
876 \define@key[psset]{pstricks-add}{adamsorder}{\def\psk@adamsorder{#1}}%
877 %\define@key[psset]{pstricks-add}{varstepincrease}{\def\psk@varstepincrease{#1}}% varrk4
878 %
879 \define@boolkey[psset]{pstricks-add}[Pst@]{saveSumValue}[true]{}
880 \psset[pstricks-add]{saveSumValue=false}
881
882 \define@key[psset]{pstricks-add}{StepType}{\pst@expandafter\psset@@StepType{#1}\@nil}%
883 \def\psset@@StepType#1#2\@nil{%
884 \ifx#1u\let\psk@StepType\@ne
885 \else\ifx#1l\let\psk@StepType\z@
886 \else\ifx#1i\let\psk@StepType\thr@@
887 \else\ifx#1s\let\psk@StepType\f@ur
888 \else\let\psk@StepType\tw@\fi\fi\fi\fi}
889 \psset{StepType=lower} % alternative StepType=upper/inf/sup/Riemann
890 \define@boolkey[psset]{pstricks-add}[Pst@]{noVerticalLines}[true]{}%
891 \psset{noVerticalLines=false}
892 \define@boolkey[psset]{pstricks-add}[Pst@]{drawLines}[true]{}%
893 \psset{drawLines=true}
894 %
895 \newcount\pst@stepcount
896 \pst@stepcount=1
897 \def\get@Letter#1;{%
898 \ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or
899 K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or
900 Y\or Z\else0\fi}
901
902
903 \def\psStep{\def\pst@par{}\pst@object{psStep}}
904 \def\psStep@i(#1,#2)#3#4{%
905 \expandafter\xdef\csname pstArea\get@Letter\the\pst@stepcount;\endcsname{undef}%
906 \IfFileExists{\jobname-area\the\[email protected]}{\input{\jobname-area\the\[email protected]}}{}%
907 \begin@ClosedObj
908 \addto@pscode{
909 \ifPst@saveSumValue
910 /AreaFile (\jobname-area\the\[email protected]) (w) file def
911 AreaFile (\string\% Created by \string\\psStep\string\n ) writestring
912 \fi
913 /Func \ifPst@algebraic (#4) tx@addDict begin AlgParser end cvx \else {#4} \fi def
914 /x #1 def
915 /dx #2 #1 sub #3 div def
916 /scx { \pst@number\psxunit mul } def
917 /scy { \pst@number\psyunit mul } def
918 /Area 0 def
919 %
920 \ifcase\psk@StepType % 0->lower, height is always f(x)
921 \ifPst@drawLines x scx 0 moveto \fi
922 #3 {
923 Func dup dx mul Area add /Area ED
924 \ifPst@drawLines scy dup x scx exch \ifPst@noVerticalLines moveto \else lineto \fi
925 \else pop \fi
926 /x x dx add def
927 \ifPst@drawLines
928 x scx exch lineto
929 x scx 0 \ifPst@noVerticalLines moveto \else lineto \fi
930 \fi
931 } repeat
932 \or % 1-> upper, height is always f(x+dx)
933 \ifPst@drawLines x scx 0 moveto \fi
934 #3 {
935 /x x dx add def
936 Func \ifPst@saveSumValue dup dx mul Area add /Area ED \fi
937 \ifPst@drawLines
938 scy dup x dx sub scx exch
939 \ifPst@noVerticalLines moveto \else lineto \fi
940 x scx exch lineto
941 x scx 0 \ifPst@noVerticalLines moveto \else lineto \fi
942 \else
943 pop
944 \fi
945 } repeat
946 \ifPst@saveSumValue
947 \fi
948 \or % 2-> Riemann
949 /eps3 500 def %% increased from 100 to 500 20140507
950 /xMinMax [] def
951 /AMax [] def
952 /AMin [] def
953 /dt dx eps3 div def
954 #3 {
955 /Max Func def
956 /Min Max def
957 /t x def % save x value
958 eps3 {
959 Func \ifPst@saveSumValue dup dx mul Area add /Area ED \fi
960 dup
961 Max lt { /Max exch def } { dup Min gt { /Min exch def }{ pop } ifelse } ifelse
962 /x x dt add def
963 } repeat
964 /x t def % restore
965 x scx Min scy Max scy xMinMax aload length 3 add array astore /xMinMax exch def
966 /x x dx add def
967 closepath
968 } repeat
969 /dx dx scx def
970 \ifPst@drawLines
971 xMinMax aload length 3 div cvi {
972 /yMax ED /yMin ED /x ED
973 x yMin moveto
974 dx 0 \ifPst@noVerticalLines rmoveto \else rlineto \fi
975 x dx add yMax lineto
976 dx neg 0 \ifPst@noVerticalLines rmoveto \else rlineto \fi
977 x yMin \ifPst@noVerticalLines moveto \else lineto \fi
978 closepath
979 \fi
980 } repeat
981 \or % 3->inf(imum)
982 % \ifPst@drawLines
983 x scx 0 moveto
984 % \fi
985 #3 {
986 \ifPst@algebraic Func \else #4 \fi
987 \ifPst@saveSumValue dup dx mul Area add /Area ED \fi
988 /yMin ED % Max value f(x)
989 /xStart x def
990 /xEnd xStart dx add def
991 /DX dx 100 div def
992 xStart DX xEnd {
993 /x ED
994 \ifPst@algebraic Func \else #4 \fi /yVal ED
995 yVal yMin lt { /yMin yVal def } if
996 } for
997 % y0 y1 gt { y0 }{ y1 } ifelse % use supremum
998 /x xEnd def
999 yMin scy dup xStart scx exch \ifPst@noVerticalLines moveto \else lineto \fi
1000 x scx exch lineto
1001 x scx 0 \ifPst@noVerticalLines moveto \else lineto \fi
1002 closepath x scx 0 moveto
1003 } repeat
1004 \or % 4-> sup(remum)
1005 x scx 0 moveto
1006 #3 {
1007 \ifPst@algebraic Func \else #4 \fi
1008 \ifPst@saveSumValue dup dx mul Area add /Area ED \fi
1009 /yMax ED % Max value f(x)
1010 /xStart x def
1011 /xEnd xStart dx add def
1012 /DX dx 100 div def
1013 xStart DX xEnd {
1014 /x ED
1015 \ifPst@algebraic Func \else #4 \fi /yVal ED
1016 yVal yMax gt { /yMax yVal def } if
1017 } for
1018 % y0 y1 gt { y0 }{ y1 } ifelse % use supremum
1019 /x xEnd def
1020 yMax scy dup xStart scx exch \ifPst@noVerticalLines moveto \else lineto \fi
1021 x scx exch lineto
1022 x scx 0 \ifPst@noVerticalLines moveto \else lineto \fi
1023 closepath x scx 0 moveto
1024 } repeat
1025 \fi
1026 \ifPst@saveSumValue
1027 AreaFile (\string\\gdef\string\\pstArea\get@Letter\the\pst@stepcount;\string{) writestring
1028 Area 10 string cvs AreaFile exch writestring
1029 AreaFile (\string}\string\n) writestring
1030 AreaFile closefile
1031 \fi
1032 }%
1033 \global\advance\pst@stepcount by 1
1034 \psk@fillstyle
1035 \pst@stroke
1036 \end@ClosedObj
1037 \ignorespaces
1038 }
1039 %
1040 \define@key[psset]{pstricks-add}{Derive}{\def\psk@Derive{#1}}
1041 %\define@key[psset]{pstricks-add}{Derive}{\expandafter\psk@@Derive#1,,\@nil}%
1042 %\def\psk@@Derive#1,#2,#3\@nil{%
1043 % \ifx\relax#2\relax
1044 % \ifPST@algebraic\def\psk@Derive{ (#1) tx@addDict begin AlgParser end cvx }\else \def\psk@Derive{ #1 }\fi
1045 % \else\def\psk@Derive{ (#1)(x) tx@Derive begin Derive end tx@addDict begin AlgParser end cvx } \fi
1046 %}
1047 \define@boolkey[psset]{pstricks-add}[PST@]{Tnormal}[true]{}
1048
1049 \psset[pstricks-add]{CMYK=true}
1050 \def\@NOTEMPTY{NOT@EMPTY}%%dr 0606
1051 %
1052 \def\psTangentLine{\def\pst@par{}\pst@object{psTangentLine}}
1053 \def\psTangentLine@i(#1,#2)(#3,#4)(#5,#6)#7#8{%
1054 \begin@OpenObj%
1055 \addto@pscode{
1056 [[#1 dup dup mul exch 1 #2]
1057 [#3 dup dup mul exch 1 #4]
1058 [#5 dup dup mul exch 1 #6]]
1059 SolveLinEqSystem
1060 /abc ED
1061 abc aload pop % a b c on stack
1062 exch #7 % a c b x
1063 mul add exch % c+b*x a
1064 #7 dup mul mul add % a*x^2+b*x+c
1065 /y0 ED % save value
1066 abc aload pop pop exch % b a
1067 #7 mul 2 mul add % b+2*a*x0=mTan
1068 \ifPST@Tnormal
1069 neg 1 exch div % -1/mTan=mOrth
1070 #8 mul /dy ED % mOrth*dx=dy
1071 [
1072 #7 #8 add y0 dy add \tx@ScreenCoor % x0+dx y0 +dy
1073 #7 y0 \tx@ScreenCoor % x0 y0
1074 \else
1075 dup % mTan mTan
1076 #8 mul /dy1 ED % mTan*dx
1077 #8 neg mul /dy2 ED % mTan*-dx
1078 [
1079 #7 #8 add y0 dy1 add \tx@ScreenCoor % x0+dx y0 +dy1
1080 #7 #8 sub y0 dy2 add \tx@ScreenCoor % x0-dx y0 +dy2
1081 \fi
1082 /Lineto /lineto load def
1083 \ifshowpoints true \else false \fi
1084 \tx@setlinejoin %
1085 \tx@Line
1086 }%
1087 \end@OpenObj%
1088 \pnode(!
1089 [[#1 dup dup mul exch 1 #2][#3 dup dup mul exch 1 #4][#5 dup dup mul exch 1 #6]]
1090 SolveLinEqSystem /abc ED
1091 abc aload pop % a b c on stack
1092 exch #7 % a c b x
1093 mul add exch % c+b*x a
1094 #7 dup mul mul add % a*x^2+b*x+c
1095 /y0 ED % save value
1096 #7 y0 ){OCurve}%
1097 \pnode(!
1098 [[#1 dup dup mul exch 1 #2][#3 dup dup mul exch 1 #4][#5 dup dup mul exch 1 #6]]
1099 SolveLinEqSystem /abc ED
1100 abc aload pop % a b c on stack
1101 exch #7 % a c b x
1102 mul add exch % c+b*x a
1103 #7 dup mul mul add % a*x^2+b*x+c
1104 /y0 ED % save value
1105 abc aload pop pop exch % b a
1106 #7 mul 2 mul add % b+2*a*x0=mTan
1107 neg 1 exch div % -1/mTan=mOrth
1108 #8 mul /dy ED % mOrth*dx=dy
1109 #7 #8 add y0 dy add % x0+dx y0 +dy
1110 ){ENormal}%
1111 \pnode(!
1112 [[#1 dup dup mul exch 1 #2][#3 dup dup mul exch 1 #4][#5 dup dup mul exch 1 #6]]
1113 SolveLinEqSystem
1114 /abc ED
1115 abc aload pop % a b c on stack
1116 exch #7 % a c b x
1117 mul add exch % c+b*x a
1118 #7 dup mul mul add % a*x^2+b*x+c
1119 /y0 ED % save value
1120 abc aload pop pop exch % b a
1121 #7 mul 2 mul add % b+2*a*x0=mTan
1122 #8 mul /dy1 ED % mTan*dx
1123 #7 #8 add y0 dy1 add ){ETangent}%
1124 \ignorespaces}
1125
1126 \def\psplotTangent@x#1,#2,#3\@nil{%
1127 \def\pst@tempLeft{#1}%
1128 \def\pst@tempRight{#2}}
1129 %% #1 : x value
1130 %% #2 : delta x or x0,x1
1131 %% #3 : function
1132 \def\psplotTangent{\@ifnextchar*{\@startrue\psplotTangent@i}{\@starfalse\psplotTangent@i*}}
1133 \def\psplotTangent@i*{\@ifnextchar[{\psplotTangent@ii}{\psplotTangent@ii[]}}
1134 \def\psplotTangent@ii[#1]#2#3#4{%
1135 \pst@killglue
1136 \expandafter\psplotTangent@x#3,,\@nil\relax
1137 \begingroup
1138 \ifx\relax#1\relax\else\psset{linestyle=solid,#1}\fi
1139 \ifx\psk@Derive\@empty\ifPst@algebraic\def\psk@Derive{NOT@EMPTY}\fi\fi %%dr 0606 hv 1003
1140 \pst@addarrowdef
1141 \addto@pscode{
1142 /F@pstplot \ifPst@algebraic (#4) tx@addDict begin AlgParser end cvx \else { #4 } \fi def % define function
1143 \ifx\psk@Derive\@empty\else
1144 \ifx\psk@Derive\@NOTEMPTY\else %%dr 0606
1145 /FDer@pstplot % do we have a derivation defined?
1146 \ifPst@algebraic (\psk@Derive) tx@addDict begin AlgParser end cvx \else { \psk@Derive } \fi def % define derivation
1147 \fi %%dr 0606
1148 \fi%
1149 /@parametric false def %%dr 0606
1150 % first we calculate the origin
1151 #2 dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
1152 { /y ED /x ED /@parametric true def } % if yes, then we have 2 values %%dr 0606
1153 { \ifPst@polarplot x \ifPst@algebraic RadtoDeg \fi PtoC /y ED /x ED \else /y ED \fi } ifelse
1154 cleartomark
1155 \ifx\psk@Derive\@NOTEMPTY %%begin dr 0606
1156 % %% algebraic we can use the derivative machine
1157 /FDer@pstplot (#4) @parametric { (t) } { (x) } ifelse
1158 tx@Derive begin Derive end tx@addDict begin AlgParser end cvx def
1159 \fi %%end dr 0606
1160 x \pst@number\psxunit mul y \pst@number\psyunit mul
1161 translate % define the temporary origin
1162 % now we calculate the slope of the tangent
1163 \ifx\psk@Derive\@empty % de we have a derivation defined?
1164 #2 abs 1.0e-6 lt % no, we choose secant for the tangent
1165 { #2 0.0005 add dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
1166 { /y2 ED /x2 ED } % we have 2 values
1167 { \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi
1168 cos mul /x2 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x2 x def \fi /y2 ED } ifelse
1169 cleartomark % delete the mark
1170 #2 0.0005 sub dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
1171 { /y1 ED /x1 ED }
1172 { \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi
1173 cos mul /x1 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x1 x def \fi /y1 ED } ifelse
1174 cleartomark
1175 y2 y1 sub x2 x1 sub } % dy dx
1176 { % > 1.0e-06
1177 #2 1.0005 mul dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
1178 { /y2 ED /x2 ED } % we have 2 values
1179 { \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi
1180 cos mul /x2 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x2 x def \fi /y2 ED } ifelse
1181 cleartomark
1182 #2 .9995 mul dup /x ED /t ED tx@addDict begin mark F@pstplot end counttomark 1 gt % test, if we have parametricplot
1183 { /y1 ED /x1 ED } % we have 2 values
1184 { \ifPst@polarplot dup x \ifPst@algebraic RadtoDeg \fi
1185 cos mul /x1 ED x \ifPst@algebraic RadtoDeg \fi sin mul \else /x1 x def \fi /y1 ED } ifelse
1186 cleartomark
1187 y2 y1 sub \pst@number\psyunit mul x2 x1 sub \pst@number\psxunit mul } ifelse
1188 atan % atan(dy dx), we have the slope angle of the secant
1189 \ifPST@Tnormal 90 add \fi
1190 \else % there is a derivation defined
1191 #2 dup /x ED /t ED tx@addDict begin mark FDer@pstplot end counttomark 1 gt % test, if we have parametricplot
1192 { /y ED /x ED }
1193 { \ifPst@polarplot /Fphi ED % the value F'(phi)
1194 tx@addDict begin F@pstplot end x \ifPst@algebraic RadtoDeg \fi PtoC /y0 ED /x0 ED % the x y values
1195 x \ifPst@algebraic RadtoDeg \fi sin Fphi mul x0 add /y ED
1196 x \ifPst@algebraic RadtoDeg \fi cos Fphi mul y0 sub /x ED
1197 \else /y ED /x 1 def \fi } ifelse
1198 cleartomark
1199 y \pst@number\psyunit mul x \pst@number\psxunit mul Atan \ifPST@Tnormal 90 add \fi
1200 % y ATAN1 % we have the slope angle of the tangent. ATAN is defined int the pstricks.pro, patch 6
1201 \fi
1202 dup % to prevent rounding errors use original value
1203 cvi 180 mod 90 gt { 180 sub } if % -90 <= angle <= 90
1204 rotate % rotate, depending to the origin
1205 /Lineto /lineto load def % the pro file needs /Lineto
1206 \pst@cp % kill the currentpoint, if any
1207 [ % start array of points
1208 \ifPST@Tnormal
1209 0 \psk@nodesepA add 0 % moveto
1210 #3 \pst@number\psxunit mul \psk@nodesepB sub 0
1211 % y \pst@number\psyunit mul x \pst@number\psxunit mul Atan cos div \pst@number\psxunit mul 0 % lineto
1212 \else % points are in reverse order ...
1213 \ifx\pst@tempRight\@empty #3 \psk@nodesepA \pst@number\psxunit div sub \else \pst@tempRight\space \fi \pst@number\psxunit mul 0 % moveto
1214 \if@star 0
1215 \else
1216 \ifx\pst@tempRight\@empty #3 \psk@nodesepB \pst@number\psxunit div sub neg \else \pst@tempLeft\space \fi
1217 \pst@number\psxunit mul
1218 \fi 0 % lineto
1219 \fi
1220 \pst@usecolor\pslinecolor
1221 false % don't show the points
1222 \tx@Line
1223 \ifx\pslinestyle\@none\else
1224 \pst@number\pslinewidth SLW
1225 \tx@setStrokeTransparency
1226 \@nameuse{psls@\pslinestyle}
1227 \fi
1228 \ifshowpoints % show the points?
1229 gsave
1230 \psk@dotsize
1231 \@nameuse{psds@\psk@dotstyle}
1232 0 0 Dot
1233 grestore
1234 \fi
1235 }%
1236 \use@pscode
1237 %% ---- only for algebraic: 3 Nodes for Origin, Tangent-End and Normal-End --- 31.05.2014 TS
1238 \iffalse
1239 \ifPst@algebraic
1240 \pst@Verb{
1241 #2 /x ED % x-Wert wird definiert
1242 /Function (#4) tx@AlgToPs begin AlgToPs end cvx def
1243 /mt (#4) (x) tx@Derive begin Derive end tx@addDict begin AlgParser end cvx def % mt ist die Steigung an der Stelle x = #2
1244 x Function /y ED % y = f(x=#2) ist der Funktionswert an der Stelle x = #2
1245 #3 mt 1 Atan cos dup mul mt 1 Atan sin \pst@number\psyunit mul \pst@number\psxunit div dup mul add sqrt div /ldt ED
1246 mt 0 ge { ldt mt 1 Atan cos mul /Dx ED ldt mt 1 Atan sin mul /Dy ED }
1247 {ldt mt 1 Atan cos mul neg /Dx ED ldt mt 1 Atan sin mul neg /Dy ED } ifelse
1248 x Dx add /xt ED
1249 y Dy add /yt ED
1250 x Dy \pst@number\psyunit mul \pst@number\psxunit div add /xn ED
1251 y Dx \pst@number\psxunit mul \pst@number\psyunit div sub /yn ED
1252 }%
1253 \pnode(! x y){OCurve}%
1254 \pnode(! xt yt){ETangent}%
1255 \pnode(! xn yn){ENormal}%
1256 \psLNode(ENormal)(OCurve){2}{ENormalE}%
1257 \psLNode(ETangent)(OCurve){2}{ETangentE}%
1258 \fi
1259 \fi
1260 \endgroup
1261 \@starfalse
1262 \ignorespaces}
1263 %
1264 %% #1-#2 x range
1265 %% #3 initial value of y (which is a vector) y(0) y'(0) y''(0) ...
1266 %% #4 value of the derivative (y and t can be used)
1267 %
1268 \define@boolkey[psset]{pstricks-add}[Pst@]{GetFinalState}[true]{}
1269 \define@key[psset]{pstricks-add}{filename}{\def\psk@filename{#1}}%
1270 \define@boolkey[psset]{pstricks-add}[Pst@]{saveData}[true]{} % \ifPst@saveData
1271 \psset[pstricks-add]{GetFinalState=false,saveData=false,filename=PSTdata}
1272 %
1273 \def\Begin@SaveFinalState{ end
1274 /PST@beginspecial /@beginspecial load def
1275 /PST@endspecial /@endspecial load def
1276 /PST@setspecial /@setspecial load def
1277 /@beginspecial {} def /@endspecial{} def /@setspecial {} def
1278 tx@Dict begin
1279 }
1280 \newif\ifPst@BeginSaveFinalState \Pst@BeginSaveFinalStatefalse
1281 \def\BeginSaveFinalState{\Pst@BeginSaveFinalStatetrue}
1282 \def\End@SaveFinalState{
1283 /@beginspecial /PST@beginspecial load def
1284 /@endspecial /PST@endspecial load def
1285 /@setspecial /PST@setspecial load def
1286 }
1287 \def\EndSaveFinalState{\pstverb{\End@SaveFinalState}}
1288
1289 \def\psplotDiffEqn{\def\pst@par{}\pst@object{psplotDiffEqn}}% initial code by Dominique 2005-05-21
1290 \def\psplotDiffEqn@i#1#2#3#4{%
1291 \addbefore@par{xStart=#1}%
1292 \pst@killglue%
1293 \begingroup%
1294 \use@par%
1295 \@nameuse{beginplot@\psplotstyle}%
1296 \addto@pscode{%
1297 \ifPst@BeginSaveFinalState \Begin@SaveFinalState \fi
1298 \ifPst@saveData /Pst@data (\psk@filename) (w) file def \fi
1299 /x #1 def % first value
1300 /x1 #2 def % last value
1301 \ifPst@GetFinalState \Begin@SaveFinalState /y FinalState def
1302 \else /y [ #3 ] def \fi % values for t=0
1303 /ylength y length def % number of elements in #3
1304 /addvect {
1305 1 1 ylength {
1306 /i exch def
1307 ylength i sub 2 add -1 roll add ylength 2 mul i sub 1 roll
1308 } for
1309 } def
1310 /dx x1 x sub \psk@plotpoints\space div def
1311 /mulvect {
1312 ylength exch
1313 1 index {
1314 dup 4 -1 roll mul 2 index 2 add 1 roll
1315 } repeat
1316 pop pop } def
1317 /divvect { ylength exch 1 index { dup 4 -1 roll exch div 2 index 2 add 1 roll } repeat pop pop } def
1318 /k0 0 def /k1 0 def /k2 0 def /k3 0 def
1319 \ifPst@algebraic /F@pstplot (#4) tx@addDict begin AlgParser end cvx def \fi
1320 /Func {
1321 \ifPst@algebraic F@pstplot ylength array astore
1322 \else
1323 \ifPst@buildvector\else y aload pop \fi #4
1324 \ifPst@buildvector\else ylength array astore \fi
1325 \fi
1326 } def
1327 \ifx\psk@method\@adams /F1 0 def /F2 0 def /F3 0 def /F4 0 def /F5 0 def /F6 0 def /INIT 1 def \fi
1328 \ifx\psk@method\@empty\else
1329 \ifx\psk@method\@varrkiv %% RUNGE-KUTTA method with var step algorithm
1330 /VarStep false def /VarStepRatio 1 def
1331 /RK {
1332 /k0 Func { dx mul } forall ylength array astore def %% y
1333 dup aload pop k0 { 2 div } forall addvect ylength array astore /y exch def %
1334 x dup dx 2 div add /x exch def %% y x
1335 /k1 Func { dx mul } forall ylength array astore def %% y x
1336 exch dup aload pop k1 { 2 div } forall addvect y astore pop %% x y
1337 /k2 Func { dx mul } forall ylength array astore def %% x y
1338 dup aload pop k2 aload pop addvect y astore pop exch dup dx add /x exch def %% y x
1339 /k3 Func { dx mul } forall ylength array astore def %% y x
1340 /x exch def %% y
1341 dup aload pop k0 aload pop k1 aload pop k2 aload pop addvect
1342 2 mulvect addvect k3 aload pop addvect
1343 6 divvect addvect y astore
1344 } def
1345 /VARRK {
1346 VarStep
1347 %{ /dx dx \psk@varstepincrease\space mul def /VarStep false def } if
1348 { /dx dx VarStepRatio mul def /VarStep false def } if
1349 x dx add x1 gt { /dx x1 x sub def } if
1350 %{ /dx dx \psk@varstepdecrease\space div def } ifelse
1351 %% we compute y(x+dx) from y(x) using RK4
1352 RK %% y(x) y(x+dx)
1353 exch /y exch def /dx dx 2 div def
1354 { %% we compute y(x+dx/2) from y(x) using RK4
1355 y RK %% y(x+dx) y(x+dx/2)
1356 %% then y(x+dx) from y(x+dx/2) using RK4
1357 /y exch def y RK %% y(x+dx) y(x) y(x+dx/2) y(x+dx)
1358 dup aload pop 4 ylength add -1 roll
1359 { -1 mul } forall addvect 0 ylength { exch abs 2 copy lt { exch } if pop } repeat
1360 0 3 -1 roll {abs 2 copy lt { exch } if pop } forall
1361 dup 1e-6 lt { pop } { div } ifelse
1362 /dx dx 2 mul def
1363 dup \psk@varsteptol\space lt
1364 %{ \psk@varsteptol\space div .1 lt { /VarStep true def } if pop exit } if
1365 %pop /dx dx 4 div def exch /y exch def } loop
1366 { .001 div dup .1 lt
1367 { dup 1e-6 lt { pop 3 } { log neg } ifelse /VarStepRatio exch def /VarStep true def }
1368 { pop } ifelse pop exit } if
1369 pop /dx dx 4 div def exch /y exch def } loop
1370 } def
1371 \else %% RUNGE-KUTTA & ADAMS methods
1372 /RK {
1373 /k0 Func { dx mul } forall ylength array astore def %% y
1374 dup aload pop k0 { 2 div } forall addvect ylength array astore /y exch def %
1375 x dup dx 2 div add /x exch def %% y x
1376 /k1 Func { dx mul } forall ylength array astore def %% y x
1377 exch dup aload pop k1 { 2 div } forall addvect y astore pop %% x y
1378 /k2 Func { dx mul } forall ylength array astore def %% x y
1379 dup aload pop k2 aload pop addvect y astore pop exch dup dx add /x exch def %% y x
1380 /k3 Func { dx mul } forall ylength array astore def %% y x
1381 /x exch def %% y
1382 dup aload pop k0 aload pop k1 aload pop k2 aload pop addvect
1383 2 mulvect addvect k3 aload pop addvect
1384 6 divvect addvect y astore pop
1385 } def
1386 \ifx\psk@method\@adams
1387 /ADAMS {
1388 \ifcase\psk@adamsorder
1389 \errmessage{pstricks-add error: no order 0th for adams method (see user's manual)}
1390 \or\errmessage{pstricks-add error: no order 1st for adams method (see user's manual)}
1391 \or\errmessage{pstricks-add error: no order 2nd for adams method (see user's manual)}
1392 \or\errmessage{pstricks-add error: no order 3rd for adams method (see user's manual)}
1393 \or
1394 %% ORDRE 4
1395 F4 aload pop 55 mulvect
1396 F3 aload pop -59 mulvect addvect
1397 F2 aload pop 37 mulvect addvect
1398 F1 aload pop -9 mulvect addvect
1399 dx mulvect 24 divvect
1400 \or
1401 %% ORDRE 5
1402 F5 aload pop 1901 mulvect
1403 F4 aload pop -2774 mulvect addvect
1404 F3 aload pop 2616 mulvect addvect
1405 F2 aload pop -1274 mulvect addvect
1406 F1 aload pop 251 mulvect addvect
1407 dx mulvect 720 divvect
1408 \or
1409 %% ORDRE 6
1410 F6 aload pop 4277 mulvect
1411 F5 aload pop -7923 mulvect addvect
1412 F4 aload pop 9982 mulvect addvect
1413 F3 aload pop -7298 mulvect addvect
1414 F2 aload pop 2877 mulvect addvect
1415 F1 aload pop -475 mulvect addvect
1416 dx mulvect 1440 divvect
1417 \fi
1418 y aload pop addvect ylength array astore /y exch def } def
1419 \fi
1420 \fi
1421 \fi
1422 /xy {
1423 \ifx\psk@plotfuncx\@empty
1424 \ifx\psk@whichabs\@empty x \else y \psk@whichabs\space get \fi
1425 \else \psk@plotfuncx\space \fi
1426 \pst@number\psxunit mul y
1427 \ifx\psk@method\@empty %% EULER method
1428 /y Func { dx mul } forall y aload pop addvect ylength array astore def
1429 \else%
1430 \ifx\psk@method\@varrkiv %% RUNGE-KUTTA method
1431 VARRK
1432 \else\ifx\psk@method\@rkiv %% RUNGE-KUTTA method
1433 RK
1434 \else
1435 /F1 F2 def /F2 F3 def /F3 F4 def /F4 %% ADAMS method
1436 \ifcase\psk@adamsorder\or\or\or\or
1437 %% ORDRE 4
1438 Func def
1439 \or
1440 %% ORDRE 5
1441 F5 def /F5 Func def
1442 \or
1443 %% ORDRE 6
1444 F5 def /F5 F6 def /F6 Func def
1445 \fi
1446 INIT \psk@adamsorder\space lt
1447 { RK /INIT INIT 1 add def }
1448 { ADAMS } ifelse
1449 \fi\fi
1450 \fi
1451 \ifx\psk@plotfuncy\@empty
1452 \ifx\psk@whichord\@empty 0 \else \psk@whichord\space \fi get %
1453 \else \psk@plotfuncy\space \fi
1454 \pst@number\psyunit mul
1455 % Pst@data (\string\[) writestring
1456 \ifPst@saveData
1457 2 copy
1458 \pst@number\psyunit div exch \pst@number\psxunit div
1459 20 string cvs Pst@data exch writestring
1460 Pst@data (\space) writestring
1461 20 string cvs Pst@data exch writestring
1462 Pst@data (\string\n) writestring
1463 \fi
1464 } def
1465 }%
1466 \gdef\psplot@init{}%
1467 \@pstfalse
1468 \@nameuse{testqp@\psplotstyle}%
1469 \if@pst\psplot@ii\else\psplot@iii\fi
1470 % \addto@pscode{\ifPst@saveData Pst@data closefile \fi}
1471 \endgroup%
1472 \ignorespaces%
1473 }
1474 %
1475 %
1476 \def\psGTriangle{\def\pst@par{}\pst@object{psGTriangle}}
1477 \def\psGTriangle@i(#1)(#2)(#3)#4#5#6{{%
1478 \begin@ClosedObj
1479 \pst@getcoor{#1}\pst@tempA % A: "rgb xr xg xb" or "gray xg"
1480 \pst@getcoor{#2}\pst@tempB % B
1481 \pst@getcoor{#3}\pst@tempC % C
1482 \pst@getcolor{#4}\pst@colorA
1483 \pst@getcolor{#5}\pst@colorB
1484 \pst@getcolor{#6}\pst@colorC
1485 \addto@pscode{%
1486 \pst@tempC % C
1487 \pst@tempB % B
1488 \psk@gangle % rotating angle
1489 \pst@tempA % A, temporary origin
1490 % /rgb {} def
1491 % /gray {} def
1492 % /rg /setrgbcolor load def
1493 % /RG /setrgbcolor load def
1494 % we use RGB
1495 [ \psgetRGBColorValues{\pst@colorC} ] aload length 1 eq { dup dup } if 3 array astore % gray -> rgb
1496 [ \psgetRGBColorValues{\pst@colorB} ] aload length 1 eq { dup dup } if 3 array astore
1497 [ \psgetRGBColorValues{\pst@colorA} ] aload length 1 eq { dup dup } if 3 array astore
1498 tx@addDict begin GTriangle end % PS part
1499 }%
1500 \if@star\pspolygon[fillstyle=none](#1)(#2)(#3)\fi% draw borderline
1501 \def\pst@linetype{2}%
1502 \end@ClosedObj%
1503 }\ignorespaces}
1504 %
1505 \def\psdice{\def\pst@par{}\pst@object{psdice}}
1506 \def\psdice@i#1{{%
1507 \pst@killglue%
1508 \addbefore@par{framearc=0.3,linewidth=1pt}%
1509 \use@par%
1510 \psframe(-0.5,-0.5)(0.5,0.5)%
1511 \ifodd#1 \qdisk(0,0){0.1\psunit}\else\qdisk(-0.3,-0.3){0.1\psunit}\qdisk(0.3,0.3){0.1\psunit}\fi
1512 \ifcase#1%
1513 \or\or\or\qdisk(-0.3,-0.3){0.1\psunit}\qdisk(0.3,0.3){0.1\psunit}% 3
1514 \or\qdisk(-0.3,0.3){0.1\psunit}\qdisk(0.3,-0.3){0.1\psunit}% 4
1515 \or\qdisk(-0.3,-0.3){0.1\psunit}\qdisk(0.3,0.3){0.1\psunit}% 5
1516 \qdisk(-0.3,0.3){0.1\psunit}\qdisk(0.3,-0.3){0.1\psunit}
1517 \or\qdisk(-0.3,0.3){0.1\psunit}\qdisk(0.3,-0.3){0.1\psunit}% 6
1518 \qdisk(-0.3,0){0.1\psunit}\qdisk(0.3,0){0.1\psunit}%
1519 \fi%
1520 \ignorespaces%
1521 }}
1522 %
1523 % the datafile must be a matrix with
1524 % /dotmatrix [
1525 % .....
1526 % .....
1527 % ] def
1528 %
1529 \def\pswavelengthToGRAY{ tx@addDict begin wavelengthToGRAY end }
1530 \def\pswavelengthToRGB{ tx@addDict begin wavelengthToRGB Red Green Blue end }
1531 %
1532 \define@key[psset]{pstricks-add}{Xoffset}[0pt]{\pst@getlength{#1}\psk@Xoffset}
1533 \define@key[psset]{pstricks-add}{Yoffset}[0pt]{\pst@getlength{#1}\psk@Yoffset}
1534 \define@key[psset]{pstricks-add}{XYoffset}[0pt]{\pst@getlength{#1}\psk@Xoffset\let\psk@Yoffset\psk@Xoffset}
1535 \psset[pstricks-add]{XYoffset=0pt}
1536 \define@boolkey[psset]{pstricks-add}[Pst@]{PixelPlot}[true]{} % \ifPst@saveData
1537 \define@key[psset]{pstricks-add}{colorType}[0]{\def\psk@colorType{#1}}
1538 \define@key[psset]{pstricks-add}{colorTypeDef}[{}]{\def\psk@colorTypeDef{#1\space}}
1539 \psset[pstricks-add]{PixelPlot=false,colorType=0,colorTypeDef={}} % 0-> two color mode 1->wavelength mode (400..700nm)
1540 % 0-> two color mode
1541 % 1-> wavelength mode (400..700nm)
1542 % 2-> wavelength mode inverse
1543 % 3-> gray color mode
1544 % 4-> gray color mode invers
1545 % 5-> own color definition
1546 %
1547
1548 \def\psMatrixPlot{\def\pst@par{}\pst@object{psMatrixPlot}}
1549 \def\psMatrixPlot@i#1#2#3{%
1550 \pst@killglue%
1551 \addbefore@par{xStep=1,yStep=1}%
1552 \begin@SpecialObj%
1553 \addto@pscode{
1554 20 dict begin
1555 (#3) run % load the data file
1556 /Min 0 def /Max 0 def
1557 dotmatrix { dup Min lt { /Min ED } { dup Max gt { /Max ED } { pop } ifelse } ifelse } forall
1558 /dMaxMin Max Min sub def
1559 \psk@dotsize % defines /DS ... def
1560 \psk@Xoffset\space \psk@Yoffset\space translate
1561 \ifPst@PixelPlot\else\@nameuse{psds@\psk@dotstyle}\fi
1562 /n 0 def % index for element
1563 1 1 #1 { % the y loop (outer one)
1564 /y exch def % save y
1565 1 1 #2 { % the x loop (inner one)
1566 /x exch def % save x
1567 dotmatrix n get % get value from matrix
1568 \ifcase\psk@colorType
1569 dup 0 gt { % test if > 0
1570 \or
1571 Min sub dMaxMin div 300 mul 400 add
1572 \pswavelengthToRGB setrgbcolor
1573 \or
1574 Min sub dMaxMin div neg 1 add 300 mul 400 add
1575 \pswavelengthToRGB setrgbcolor
1576 \or
1577 Min sub dMaxMin div neg 1 add 300 mul 400 add
1578 \pswavelengthToGRAY setgray
1579 \or
1580 Min sub dMaxMin div neg 1 add 300 mul 400 add
1581 \pswavelengthToGRAY neg 1 add setgray
1582 \or
1583 currentdict /colorTypeDef known { colorTypeDef } { \psk@colorTypeDef } ifelse
1584 \fi
1585 x \psk@xStep\space mul \pst@number\psxunit mul
1586 \ifPst@ChangeOrder #1 y sub 1 add \else y \fi \psk@yStep\space mul \pst@number\psyunit mul
1587 \ifPst@PixelPlot 1 DS mul 0 360 arc fill \else Dot \fi
1588 \ifcase\psk@colorType
1589 } { pop } ifelse
1590 \fi
1591 /n n 1 add def
1592 } for
1593 } for
1594 end
1595 }%
1596 \end@SpecialObj%
1597 \ignorespaces%
1598 }
1599 %
1600 \newdimen\chart@ColorIndex
1601 \newdimen\chart@ColorStep
1602 \newdimen\pst@chartHeight
1603 \newdimen\pst@chartStackDepth
1604 \newdimen\pst@chartStackWidth
1605 \newcount\chart@Toggle
1606 \newif\if@chartSep
1607 \newif\if@chartUserColor
1608 %
1609 \define@key[psset]{pstricks-add}{chartStyle}{\def\psk@chartStyle{#1}}
1610 \psset[pstricks-add]{chartStyle=pie}% p)ie P)ie-3d-view h)istogram H)istogram-3dview
1611 %
1612 \define@key[psset]{pstricks-add}{chartColor}{\pst@expandafter\psk@@chartColor{#1}\@nil}
1613 \def\psk@@chartColor#1#2\@nil{%
1614 \ifx#1r\def\psk@chartColor{2}\else%
1615 \ifx#1c\def\psk@chartColor{380}\else\def\psk@chartColor{0}\fi\fi}
1616 \psset[pstricks-add]{chartColor=gray}% gray, color, randomColor
1617 %
1618 \define@key[psset]{pstricks-add}{chartSep}{\pst@getlength{#1}\psk@chartSep}
1619 \define@key[psset]{pstricks-add}{chartStack}{\pst@getint{#1}\psk@chartStack}
1620 \define@key[psset]{pstricks-add}{chartStackDepth}{\pssetylength\pst@chartStackDepth{#1}}
1621 \define@key[psset]{pstricks-add}{chartStackWidth}{\pssetxlength\pst@chartStackWidth{#1}}
1622 \define@key[psset]{pstricks-add}{chartHeight}{\pssetylength\pst@chartHeight{#1}}
1623 \psset[pstricks-add]{chartSep=10pt,chartStack=0,chartStackDepth=2cm,chartStackWidth=2cm,%
1624 chartHeight=5mm}
1625 %
1626 \define@boolkey[psset]{pstricks-add}[Pst@]{uselinecolor}[true]{}
1627 \psset[pstricks-add]{uselinecolor=false}
1628 %
1629 \define@key[psset]{pstricks-add}{userColor}{%
1630 \chart@Toggle=0\relax%
1631 \def\chart@option{#1}%
1632 \ifx\chart@option\@empty\@chartUserColorfalse%
1633 \else%
1634 \@chartUserColortrue%
1635 \expandafter\psk@@chartUserColor#1,,\@nil%
1636 \fi}
1637 \def\psk@@chartUserColor#1,#2,#3\@nil{%
1638 \advance\chart@Toggle by \@ne%
1639 \xglobal\colorlet{chartFillColor\the\chart@Toggle}{#1}%
1640 \def\chart@option{#2}%
1641 \ifx\chart@option\@empty\else\psk@@chartUserColor#2,#3,\@nil\fi}%
1642 \psset[pstricks-add]{userColor={}}
1643
1644 \define@key[psset]{pstricks-add}{chartNodeI}{\def\psk@chartNodeI{#1}}
1645 \define@key[psset]{pstricks-add}{chartNodeO}{\def\psk@chartNodeO{#1}}
1646 \psset[pstricks-add]{chartNodeI=0.75,chartNodeO=1.5}
1647 %
1648 \def\psChart{\pst@object{psChart}}
1649 \def\psChart@i#1#2#3{%
1650 % #1:values #2:separated charts
1651 % #3 radius->pie; max height->histogram
1652 \pst@killglue%
1653 \global\pssetylength\pst@chartHeight{#3}%
1654 \global\let\pst@chartRadius\pst@chartHeight%
1655 \begingroup
1656 \edef\psk@chartValues{#1}%
1657 \def\psk@chartSepValues{#2}% only valid for a pie chart
1658 \pst@dimm=\z@% sum of all entries (for a pie)
1659 \pst@cnta=1\relax% number of entries
1660 \pst@dimn=\z@% greatest entry
1661 \psforeach{\chart@tempA}{#1}{%
1662 \global\advance\pst@cnta by \@ne% % no of entries
1663 \global\advance\pst@dimm by \chart@tempA\p@% % sum of all entries
1664 \pst@dima=\chart@tempA\p@%
1665 \ifdim\pst@dima>\pst@dimn\global\pst@dimn=\pst@dima\fi%
1666 }%
1667 \addbefore@par{linejoin=2,dimen=outer}%
1668 \begin@SpecialObj%
1669 \ifnum\psk@chartColor>0\relax%
1670 \chart@ColorStep=400\p@\else\chart@ColorStep=\p@\fi % the "numerical color"
1671 \divide\chart@ColorStep by \pst@cnta% % step =1/no or 400/no
1672 \chart@ColorIndex=\psk@chartColor\p@% % the start color (gray or wave)
1673 \@nameuse{pscs@\psk@chartStyle}%
1674 \end@SpecialObj%
1675 \endgroup%
1676 \ignorespaces%
1677 }
1678 %
1679 \def\pscs@pie{%
1680 \degrees[\pst@number\pst@dimm]% % instead of 360 degrees
1681 \def\chart@alpha{0}%
1682 \pst@dimm=\z@\pst@dimn=\z@\pst@dimo=\z@\pst@cnta=0\relax%
1683 \global\chart@Toggle=1\relax%
1684 \ifpsshadow% create shadow first
1685 \psforeach{\chart@tempA}{\psk@chartValues}{%
1686 \global\advance\pst@dimm by \chart@tempA\p@%
1687 \global\advance\pst@dimn by \chart@alpha\p@%
1688 \global\advance\pst@cnta by \@ne%
1689 \pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart
1690 \global\@chartSepfalse%
1691 \if$\psk@chartSepValues$\else%
1692 \psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta\relax\global\@chartSeptrue\fi}%
1693 \fi%
1694 \if@chartSep%
1695 \pswedge(\psk@chartSep\p@;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
1696 \else%
1697 \pswedge(0,0){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
1698 \fi%
1699 \global\let\chart@alpha\chart@tempA%
1700 }%
1701 \psshadowfalse%
1702 \fi%
1703 \def\chart@alpha{0}%
1704 \pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0\relax%
1705 \psForeach{\chart@tempA}{\psk@chartValues}{%
1706 \global\advance\pst@dimm by \chart@tempA\p@%
1707 \global\advance\pst@dimn by \chart@alpha\p@%
1708 \def\pst@tempB{\pst@number\chart@ColorIndex}%
1709 % \psDEBUG[psChart:wave:color]{\pst@tempB}%
1710 \global\advance\pst@cnta by \@ne%
1711 \if@chartUserColor\else%
1712 \def\chart@FillColor{chartFillColor\the\pst@cnta}%
1713 \ifnum\psk@chartColor>0\relax%
1714 \xglobal\definecolor{\chart@FillColor}{wave}{\pst@tempB}%
1715 \else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi%
1716 \fi%
1717 \pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart
1718 \global\@chartSepfalse%
1719 \if$\psk@chartSepValues$\else%
1720 \psForeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta\relax\global\@chartSeptrue\fi}%
1721 \fi%
1722 \if@chartSep
1723 \ifPst@uselinecolor
1724 \pswedge[linecolor=\pslinecolor,fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]%
1725 (\psk@chartSep\p@;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
1726 \else
1727 \pswedge*[linecolor={chartFillColor\the\pst@cnta}]%
1728 (\psk@chartSep\p@;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
1729 \fi
1730 \pst@dima=\pst@chartRadius\advance\pst@dima by \psk@chartSep\p@%
1731 \pnode(\pst@dima;\pst@number\pst@dimo){psChart\the\pst@cnta}%
1732 \pst@dimb=\psk@chartNodeI\pst@dima%
1733 \pst@dimc=\psk@chartNodeO\pst@dima%
1734 \pnode(\pst@dimb;\pst@number\pst@dimo){psChartI\the\pst@cnta}%
1735 \pnode(\pst@dimc;\pst@number\pst@dimo){psChartO\the\pst@cnta}%
1736 \else%
1737 \ifPst@uselinecolor
1738 \pswedge[linecolor=\pslinecolor,fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}](0,0)%
1739 {\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
1740 \else
1741 \pswedge*[linecolor={chartFillColor\the\pst@cnta}](0,0)%
1742 {\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}%
1743 \fi
1744 \pnode(\pst@chartRadius;\pst@number\pst@dimo){psChart\the\pst@cnta}%
1745 \pst@dima=\pst@chartRadius%
1746 \pst@dimb=\psk@chartNodeI\pst@dima%
1747 \pst@dimc=\psk@chartNodeO\pst@dima%
1748 \pnode(\pst@dimb;\pst@number\pst@dimo){psChartI\the\pst@cnta}%
1749 \pnode(\pst@dimc;\pst@number\pst@dimo){psChartO\the\pst@cnta}%
1750 \fi%
1751 \global\let\chart@alpha\chart@tempA%
1752 \global\advance\chart@Toggle by \@ne%
1753 \ifnum\chart@Toggle<3\relax%
1754 \global\advance\chart@ColorIndex by 2\chart@ColorStep%
1755 \else%
1756 \global\chart@Toggle=0%
1757 \global\advance\chart@ColorIndex by -\chart@ColorStep%
1758 \fi%
1759 }% end foreach
1760 \ignorespaces%
1761 }
1762 %
1763 \def\pscs@histogram{%
1764 \def\chart@maxValue{\pst@number\pst@dimn}% max of the data
1765 \pst@@divide\pst@dimn\pst@chartHeight% maxValue/maxHeight
1766 \psDEBUG[pscs@histogram]{chart@maxValue=\chart@maxValue}
1767 \psDEBUG[pscs@histogram]{(maxValue/maxHeight)pst@dimg=\pst@number\pst@dimg}
1768 \psDEBUG[pscs@histogram]{pst@chartHeight=\the\pst@chartHeight}
1769 \pst@dimo=28.46\pst@dimg
1770 \edef\pst@chartUnit{\pst@number\pst@dimo}
1771 % \psaxes[axesstyle=frame,
1772 % dy=1cm,Dy=\pst@number\pst@dimo](\the\pst@cnta,\the\pst@chartHeight)
1773 \pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0%
1774 \global\chart@Toggle=1
1775 \psforeach{\chart@tempA}{\psk@chartValues}{%
1776 \global\advance\pst@dimm by \chart@tempA pt%
1777 \def\pst@tempB{\pst@number\chart@ColorIndex}%
1778 \psDEBUG[psChart:wave:color]{\pst@tempB}%
1779 \global\advance\pst@cnta by \@ne%
1780 \if@chartUserColor\else
1781 \def\chart@FillColor{chartFillColor\the\pst@cnta}
1782 \ifnum\psk@chartColor>0 \xglobal\definecolor{\chart@FillColor}{wave}{\pst@tempB}%
1783 \else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi%
1784 \fi
1785 \psframe[linecolor={chartFillColor\the\pst@cnta},fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]%
1786 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub 0)
1787 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add \chart@tempA\space \pst@chartUnit\space div)
1788 \pnode(!\the\pst@cnta\space 0){psChart\the\pst@cnta}%
1789 \pnode(!\the\pst@cnta\space \chart@tempA\space 2 div \pst@chartUnit\space div){psChartM\the\pst@cnta}%
1790 \pnode(!\the\pst@cnta\space \chart@tempA\space \pst@chartUnit\space div){psChartT\the\pst@cnta}%
1791 \global\advance\chart@Toggle by \@ne
1792 \ifnum\chart@Toggle<3
1793 \global\advance\chart@ColorIndex by 2\chart@ColorStep
1794 \else
1795 \global\chart@Toggle=0
1796 \global\advance\chart@ColorIndex by -\chart@ColorStep%
1797 \fi%
1798 }% end foreach
1799 }
1800 %
1801 \def\pst@stackList{}
1802 \def\addbefore@stackList#1{%
1803 \ifx\pst@stackList\@empty
1804 \xdef\pst@stackList{#1}%
1805 \else
1806 \toks@{#1}%
1807 \pst@toks\expandafter{\pst@stackList}%
1808 \xdef\pst@stackList{\the\toks@,\the\pst@toks}%
1809 \fi%
1810 }
1811 %
1812 \def\pscs@Histogram{%
1813 \psDEBUG[pscs@Histogram]{psk@chartStack=\psk@chartStack}%
1814 \def\chart@maxValue{\pst@number\pst@dimn}% max of the data
1815 \pst@@divide\pst@dimn\pst@chartHeight% maxValue/maxHeight
1816 \psDEBUG[pscs@Histogram]{chart@maxValue=\chart@maxValue}%
1817 \psDEBUG[pscs@Histogram]{(maxValue/maxHeight)pst@dimg=\pst@number\pst@dimg}%
1818 \psDEBUG[pscs@Histogram]{pst@chartHeight=\the\pst@chartHeight}%
1819 \pst@dimo=28.46\pst@dimg%
1820 \edef\pst@chartUnit{\pst@number\pst@dimo}%
1821 % \psaxes[axesstyle=frame,
1822 % dy=1cm,Dy=\pst@number\pst@dimo](\the\pst@cnta,\the\pst@chartHeight)
1823 \pst@dimm=0pt\pst@dimn=0pt\pst@dimo=0pt\pst@cnta=0%
1824 \global\chart@Toggle=1 % for color toggling
1825 \pst@cntn=0 % stacked step
1826 \pst@cnto=0 % for a stacked view
1827 \pst@cntp=\psk@chartStack % for a stacked view
1828 \def\pst@stackList{}
1829 \psDEBUG[pscs@Histogram]{psk@chartStack=\the\pst@cntp}%
1830 \psforeach{\chart@tempA}{\psk@chartValues}{% the loop
1831 \ifnum\pst@cntp>0 % stacked version?
1832 \advance\pst@cnto by \@ne % increase
1833 \psDEBUG[pscs@Histogram]{chart@tempA=\chart@tempA}%
1834 \expandafter\addbefore@stackList\expandafter{\chart@tempA}%
1835 \psDEBUG[pscs@Histogram]{stack list=\pst@stackList}%
1836 \ifnum\pst@cnto=\pst@cntp % draw?
1837 \pst@cnto=\psk@chartStack\advance\pst@cnto by \m@ne
1838 \psforeach{\chart@tempB}{\pst@stackList}{% the stack loop
1839 \global\pst@cnta=\pst@cntn % we do not need the value
1840 \psDEBUG[pscs@Histogram]{pst@cnto=\the\pst@cnto}%
1841 \psDEBUG[pscs@Histogram]{pst@chartStackDepth=\the\pst@chartStackDepth}%
1842 \psDEBUG[pscs@Histogram]{pst@chartStackWidth=\the\pst@chartStackWidth}%
1843 \edef\pst@tempA{\the\pst@cnto}%
1844 \psDEBUG[pscs@Histogram]{pst@tempA=\pst@tempA}%
1845 \ifnum\pst@cnto>0
1846 \pst@dima=\pst@chartStackDepth%
1847 \pst@dimb=\pst@chartStackWidth%
1848 \divide \pst@dima by \pst@tempA%
1849 \divide \pst@dimb by \pst@tempA%
1850 \else\pst@dima=\z@ \pst@dimb=\z@%
1851 \fi%
1852 \rput(\the\pst@dima, \the\pst@dimb){\pscs@Histogram@i{\chart@tempB}}
1853 \advance\pst@cnto by \m@ne % decrease stack counter
1854 }%
1855 \advance\pst@cntn by \tw@ % increase
1856 \def\pst@stackList{}% reset stack list
1857 \pst@cnto=0 % reset stack counter
1858 \fi%
1859 \else%
1860 \pscs@Histogram@i{\chart@tempA}% non stacked version
1861 \fi%
1862 }% end foreach
1863 }
1864 %
1865 \def\pscs@Histogram@i#1{% draw the 3d-like bar
1866 \def\pst@tempB{\pst@number\chart@ColorIndex}%
1867 \global\advance\pst@cnta by \@ne%
1868 \if@chartUserColor\else
1869 \def\chart@FillColor{chartFillColor\the\pst@cnta}
1870 \ifnum\psk@chartColor>0 \xglobal\definecolor{\chart@FillColor}{wave}{\pst@tempB}%
1871 \else\xglobal\definecolor{\chart@FillColor}{gray}{\pst@tempB}\fi%
1872 \fi
1873 \pspolygon[fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]%
1874 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub 0)% ll
1875 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add 0)% lr
1876 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div 1.5 mul add \psk@chartSep\space 56.92 div)% 'lr
1877 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div 1.5 mul add
1878 \psk@chartSep\space 56.92 div #1 \pst@chartUnit\space div add )% 'ur
1879 (!\the\pst@cnta\space \psk@chartSep\space 56.92 div sub
1880 \psk@chartSep\space 56.92 div #1 \pst@chartUnit\space div add )% 'ul
1881 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub #1 \pst@chartUnit\space div)%ul
1882 \psline%
1883 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add 0)% lr
1884 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add #1 \pst@chartUnit\space div)
1885 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div sub #1 \pst@chartUnit\space div)%ul
1886 \psline%
1887 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div add #1 \pst@chartUnit\space div)
1888 (!\the\pst@cnta\space \psk@chartSep\space 28.46 div 1.5 mul add
1889 \psk@chartSep\space 56.92 div #1 \pst@chartUnit\space div add )% 'ur
1890 \pnode(!\the\pst@cnta\space 0){psChart\the\pst@cnta}%
1891 \pnode(!\the\pst@cnta\space #1 2 div \pst@chartUnit\space div){psChartM\the\pst@cnta}%
1892 \pnode(!\the\pst@cnta\space #1 \pst@chartUnit\space div){psChartT\the\pst@cnta}%
1893 \global\advance\chart@Toggle by \@ne
1894 \ifnum\chart@Toggle<3
1895 \global\advance\chart@ColorIndex by 2\chart@ColorStep
1896 \else
1897 \global\chart@Toggle=0
1898 \global\advance\chart@ColorIndex by -\chart@ColorStep%
1899 \fi%
1900 \global\advance\chart@ColorIndex by 1pt
1901 }
1902 %
1903 \define@key[psset]{pstricks-add}{cancelType}{\pst@expandafter\psk@@cancelType{#1xx}\@nil}
1904 \def\psk@@cancelType#1#2\@nil{%
1905 \ifx\relax#1\relax\def\psk@cancelType{2}\else% x
1906 \ifx#1B\def\psk@cancelType{5}\else% \ new option B
1907 \ifx#1S\def\psk@cancelType{4}\else% \ new option S
1908 \ifx#1X\def\psk@cancelType{3}\else% \ new option X
1909 \ifx#1b\def\psk@cancelType{2}\else% \
1910 \ifx#1s\def\psk@cancelType{1}\else% /
1911 \def\psk@cancelType{0}\fi\fi\fi\fi\fi\fi}% x every other
1912
1913 \psset[pstricks-add]{cancelType=}% x, crossing
1914 \def\psCancel{\def\pst@par{}\pst@object{psCancel}}% by Stefano Baroni 2008-06-21
1915 \def\psCancel@i{\pst@makebox\psCancel@iii}
1916 \def\psCancel@iii{%
1917 \begingroup
1918 \solid@star
1919 \use@par
1920 \ifnum\psk@cancelType>\tw@ % check if \psk@cancelType > 2
1921 % here: option cancelType with small letter X, S, B
1922 \pst@dimc=\wd\pst@hbox
1923 \pst@dimb=\dp\pst@hbox
1924 \pst@dimd=\ht\pst@hbox
1925 \pst@dima=\z@
1926 \edef\psk@cancelType{\the\numexpr\psk@cancelType-3\relax}
1927 \else
1928 % here: option cancelType with capital letter x, s, b set \pst@diam as before
1929 \pst@dima=\pslinewidth
1930 \advance\pst@dima by \psframesep
1931 \pst@dimc=\wd\pst@hbox\advance\pst@dimc by \pst@dima
1932 \pst@dimb=\dp\pst@hbox\advance\pst@dimb by \pst@dima
1933 \pst@dimd=\ht\pst@hbox\advance\pst@dimd by \pst@dima
1934 \fi
1935 \setbox\pst@hbox=\hbox{%
1936 \ifpsboxsep\kern\pst@dima\fi
1937 \begin@ClosedObj
1938 \addto@pscode{
1939 \psk@cornersize % arcradius boolean
1940 \pst@number\pst@dima neg
1941 \pst@number\pst@dimb neg
1942 \pst@number\pst@dimc
1943 \pst@number\pst@dimd
1944 .5
1945 \if@star \tx@Frame \else
1946 CLW mul /a ED % the middle of the line
1947 3 -1 roll 2 copy gt { exch } if
1948 a sub /y2 ED
1949 a add /y1 ED
1950 2 copy gt { exch } if
1951 a sub /x2 ED
1952 a add /x1 ED
1953 pop pop % delete arc values
1954 \ifnum\psk@cancelType<\tw@ % / or x (1 oder 0)
1955 x1 y1 moveto
1956 x2 y2 lineto
1957 \fi
1958 \ifnum\psk@cancelType=\@ne\else % \ or x (2 oder 0)
1959 x2 y1 moveto
1960 x1 y2 lineto
1961 \fi
1962 \fi
1963 }%
1964 \def\pst@linetype{2}%
1965 \showpointsfalse
1966 \end@ClosedObj
1967 \box\pst@hbox
1968 \ifpsboxsep\kern\pst@dima\fi
1969 }%
1970 \ifpsboxsep\dp\pst@hbox=\pst@dimb\ht\pst@hbox=\pst@dimd\fi
1971 \leavevmode\box\pst@hbox
1972 \endgroup%
1973 }
1974
1975 \iffalse
1976 \define@key[psset]{pstricks-add}{cancelType}{\pst@expandafter\psk@@cancelType{#1xx}\@nil}
1977 \def\psk@@cancelType#1#2\@nil{%
1978 \ifx\relax#1\relax\def\psk@cancelType{2}\else% x
1979 \ifx#1b\def\psk@cancelType{2}\else% \
1980 \ifx#1s\def\psk@cancelType{1}\else% /
1981 \def\psk@cancelType{0}\fi\fi\fi}% x every other
1982
1983 \psset[pstricks-add]{cancelType=}% x, crossing
1984 \def\psCancel{\def\pst@par{}\pst@object{psCancel}}% by Stefano Baroni 2008-06-21
1985 \def\psCancel@i{\pst@makebox\psCancel@iii}
1986 \def\psCancel@iii{%
1987 \begingroup
1988 \solid@star
1989 \use@par
1990 \pst@dima=\pslinewidth
1991 \advance\pst@dima by \psframesep
1992 \pst@dimc=\wd\pst@hbox\advance\pst@dimc by \pst@dima
1993 \pst@dimb=\dp\pst@hbox\advance\pst@dimb by \pst@dima
1994 \pst@dimd=\ht\pst@hbox\advance\pst@dimd by \pst@dima
1995 \setbox\pst@hbox=\hbox{%
1996 \ifpsboxsep\kern\pst@dima\fi
1997 \begin@ClosedObj
1998 \addto@pscode{
1999 \psk@cornersize % arcradius boolean
2000 \pst@number\pst@dima neg
2001 \pst@number\pst@dimb neg
2002 \pst@number\pst@dimc
2003 \pst@number\pst@dimd
2004 .5
2005 \if@star \tx@Frame \else
2006 CLW mul /a ED % the middle of the line
2007 3 -1 roll 2 copy gt { exch } if
2008 a sub /y2 ED
2009 a add /y1 ED
2010 2 copy gt { exch } if
2011 a sub /x2 ED
2012 a add /x1 ED
2013 pop pop % delete arc values
2014 \ifnum\psk@cancelType<\tw@ % / or x
2015 x1 y1 moveto
2016 x2 y2 lineto
2017 \fi%
2018 \ifnum\psk@cancelType=\@ne\else % \ or x
2019 x2 y1 moveto
2020 x1 y2 lineto
2021 \fi
2022 \fi
2023 }%
2024 \def\pst@linetype{2}%
2025 \showpointsfalse
2026 \end@ClosedObj
2027 \box\pst@hbox
2028 \ifpsboxsep\kern\pst@dima\fi%
2029 }%
2030 \ifpsboxsep\dp\pst@hbox=\pst@dimb\ht\pst@hbox=\pst@dimd\fi
2031 \leavevmode\box\pst@hbox
2032 \endgroup%
2033 }
2034 \fi
2035 %
2036 \newcount\psVectorCtr
2037 \define@boolkey[psset]{pstricks-add}[Pst@]{markAngle}[true]{}
2038 \psset[pstricks-add]{markAngle=false}
2039 %
2040 \newpsstyle{psMarkAngleStyle}{arrows=->,arrowsize=4pt}
2041 \newpsstyle{psMarkAngleLineStyle}{linestyle=dotted,arrows=-}
2042 %
2043 \def\psStartPoint{\@ifnextchar[{\psStartPoint@i}{\psStartPoint@i[Vector]}}
2044 \def\psStartPoint@i[#1](#2){%
2045 \global\psVectorCtr=\@ne
2046 \gdef\psVectorName{#1}%
2047 \pnode(#2){#10}%
2048 % \pst@getcoor{#2}\pst@vector@cp
2049 \pstVerb{
2050 gsave tx@Dict begin
2051 STV CP T \psGetNodeCenter{#10}
2052 /cp.X #10.x def /cp.Y #10.y def
2053 % \pst@vector@cp
2054 % \pst@number\psyunit mul /cp.Y exch def
2055 % \pst@number\psxunit mul /cp.X exch def
2056 end grestore }%
2057 \ignorespaces}
2058 %
2059 \def\psVector{\pst@object{psVector}}
2060 \def\psVector@i{%
2061 \pst@killglue
2062 \addbefore@par{arrows=->,arrowsize=6pt}%
2063 % \addto@par{showpoints=false}%
2064 \psVector@ii}
2065
2066 \def\psVector@ii{\@ifnextchar<\psVector@iii\psVector@iv}%
2067 \def\psVector@iii<#1>{\psStartPoint(#1)\psVector@iv}
2068
2069 \def\psVector@iv(#1){%
2070 \pst@getcoor{#1}\pst@tempCoor
2071 \begingroup
2072 \use@keep@par
2073 \pst@cntm=\the\psVectorCtr \advance\pst@cntm by \m@ne
2074 \rput(\psVectorName\the\pst@cntm){% \else cp.X cp.Y \fi){%
2075 \pnode(0,0){@@@A}\pnode(#1){@@@B}
2076 \ifPst@markAngle
2077 \psarc[style=psMarkAngleStyle](0,0){1}{0}{!\pst@tempCoor exch atan}%
2078 \psline[style=psMarkAngleLineStyle](1.5,0)%
2079 \fi}%
2080 \ncline[nodesep=0pt]{@@@A}{@@@B}
2081 \pnode(! \pst@tempCoor \pst@number\psyunit div cp.Y add exch
2082 \pst@number\psxunit div cp.X add exch ){\psVectorName\the\psVectorCtr}%
2083 \global\advance\psVectorCtr by \@ne%
2084 \endgroup
2085 \pst@Verb{
2086 \pst@tempCoor
2087 \pst@number\psyunit div cp.Y add /cp.Y exch def
2088 \pst@number\psxunit div cp.X add /cp.X exch def
2089 }%
2090 \@ifnextchar(\psVector@iv\ignorespaces}
2091 %
2092 \define@key[psset]{pstricks-add}{basename}{\def\psk@basename{#1}}%
2093 \psset[pstricks-add]{basename=}%
2094 %
2095 \def\psCircleTangents{\pst@object{psCircleTangents}}
2096 \def\psCircleTangents@i(#1){\@ifnextchar({\psCircleTangents@ii(#1)}{\psCircleTangents@iii(#1)}}%
2097 \def\psCircleTangents@ii(#1)(#2)#3{% (viewpoint) (circle) {radius}
2098 \pst@killglue
2099 \begingroup
2100 \pst@getlength{#3}\pst@LengthA
2101 \addbefore@par{basename=CircleT}%
2102 \use@par
2103 % \edef\@cmd{\noexpand\psEllipseTangentsN(#2)(! \pst@LengthA dup
2104 % \pst@number\psxunit div exch \pst@number\psyunit div )(#1){\psk@basename}}%
2105 % \@cmd
2106 \psEllipseTangentsN(#2)(!\pst@LengthA dup \pst@number\psxunit div exch \pst@number\psyunit div )(#1){\psk@basename}%
2107 \endgroup
2108 \ignorespaces
2109 }%
2110 \def\psCircleTangents@iii(#1)#2(#3)#4{% two circles--- (Cntr1){radius1}(Cntr2){radius2}
2111 \pst@killglue
2112 \begingroup
2113 \pst@getlength{#2}\pst@LengthA% radius1
2114 \pst@getlength{#4}\pst@LengthB% radius2
2115 \addbefore@par{basename=CircleT}%
2116 \use@par
2117 \psLCNodeVar(#1)(#3)(! \pst@LengthA \pst@number\psrunit div dup \pst@LengthB
2118 \pst@number\psrunit div % r1 r1 r2 on stack
2119 3 copy add div /tti ED sub dup 0 eq % r1 r1-r2 on stack
2120 { pop pop /ttx 1000 def }{ div dup abs 1000 gt % r1/(r1-r2) on stack
2121 { 0 gt { ttx 1000 def }{ ttx -1000 def } ifelse}{ /ttx ED } ifelse } ifelse
2122 1 tti sub tti )% 1-tti tti on stack
2123 {\psk@basename C1}%
2124 % tti=r1/(r1+r2), ttx=r1/(r1-r2)
2125 \psLCNodeVar(#1)(#3)(! 1 ttx sub ttx ){\psk@basename C2}% outside crossing pt
2126 \expandafter\psCircleTangents@ii\expandafter(\psk@basename C1)(#1){#2}%
2127 \pnode(CircleT1){\psk@basename I1}\pnode(CircleT2){\psk@basename I3}%
2128 \expandafter\psCircleTangents@ii\expandafter(\psk@basename C1)(#3){#4}%
2129 \pnode(CircleT1){\psk@basename I2}\pnode(CircleT2){\psk@basename I4}%
2130 % external tangents
2131 \expandafter\psCircleTangents@ii\expandafter(\psk@basename C2)(#1){#2}%
2132 \pnode(CircleT1){\psk@basename O2}\pnode(CircleT2){\psk@basename O4}%
2133 \expandafter\psCircleTangents@ii\expandafter(\psk@basename C2)(#3){#4}%
2134 \pnode(CircleT1){\psk@basename O1}\pnode(CircleT2){\psk@basename O3}%
2135 \endgroup%
2136 \ignorespaces%
2137 }%
2138 %
2139 \def\psEllipseTangents{\pst@object{psEllipseTangents}}
2140 \def\psEllipseTangents@i(#1)(#2)(#3){% (Center)(axes)(viewpoint)
2141 \pst@killglue{%
2142 \use@par% only one parameter matters---psk@basename
2143 \ifx\psk@basename\@empty \def\psk@basename{EllipseT}\fi %
2144 \edef\@cmd{\noexpand\psEllipseTangentsN(#1)(#2)(#3){\psk@basename}}%
2145 \@cmd}\ignorespaces}%
2146 %
2147 \def\psEllipseTangentsN(#1)(#2)(#3)#4{% (xe,ye)(a,b)(xP,yP){basename} % no optional arguments
2148 \pst@killglue
2149 % \pst@getcoor{#1}\pst@tempA
2150 \pnode(#1){E@Cntr}%
2151 \pnode(#2){@@TMP}%
2152 \pnode(#3){@@@TMP}% (center)(semimajor, semiminor)(viewpt)
2153 \pst@getcoor{#3}\my@tempC% external viewpoint
2154 \AtoB(E@Cntr)(@@@TMP){@TMP}% center to viewpoint
2155 \ifnum\Pst@Debug>0
2156 \shownode(E@Cntr)%
2157 \shownode(@TMP)%
2158 \shownode(@@@TMP)%
2159 \fi
2160 \pnode(!
2161 \psGetNodeCenter{E@Cntr}\space
2162 /Xc [email protected] def /Yc [email protected] def
2163 \psGetNodeCenter{@@TMP}\space
2164 /B @@TMP.y def % semiminor
2165 /A @@TMP.x def % semimajor
2166 \psGetNodeCenter{@TMP}\space
2167 /Xp @TMP.x def /Yp @TMP.y def % center to viewpoint
2168 %
2169 /A2 A dup mul def /B2 B dup mul def
2170 /C2 B A div dup mul def
2171 /Xp2 Xp dup mul def /Yp2 Yp dup mul def
2172 /R Xp2 A2 sub C2 mul Yp2 add Sqrt def % R=Sqrt{(Xp2-A2) C2 + Yp2}
2173 /Q C2 Xp2 mul Yp2 add def % C2 Xp2 + Yp2
2174 /Xta B2 Xp mul A Yp R mul mul sub Q div def
2175 /Yta Yp Xp R mul A div add B2 mul Q div def
2176 /Xtb B2 Xp mul A Yp R mul mul add Q div def
2177 /Ytb Yp Xp R mul A div sub B2 mul Q div def
2178 0 Xta Yp mul Yta Xp mul sub gt % swap a, b
2179 { /A Xta def /B Yta def /Xta Xtb def /Yta Ytb def /Xtb A def /Ytb B def } if
2180 Xta Xc add %/xTemp ED
2181 Yta Yc add %/yTemp ED
2182 % xTemp Xc yTemp Yc Pyth2 /Length ED
2183 % xTemp Xc sub yTemp Yc sub exch atan 0 add Length exch PtoC
2184 % Yc add exch Xc add exch
2185 ) {#42}%
2186 \pnode(! Xtb Xc add Ytb Yc add ) {#41}%
2187 \ignorespaces}%
2188 %
2189 \define@key[psset]{pstricks-add}{rotate}{\def\psk@rotate{#1 }}
2190 \psset[pstricks-add]{rotate=0}
2191
2192 \def\pst@saveDegrees{}
2193
2194 \def\psKiviat{\pst@object{psKiviat}}
2195 \def\psKiviat@i#1#2{% #1: number of edges #2 radius
2196 \gdef\pst@saveDegrees{#1}
2197 \begingroup%
2198 \degrees[#1]%
2199 \SpecialCoor%
2200 \addbefore@par{rotate=0}
2201 \use@par%
2202 \global\let\psk@@rotate\psk@rotate
2203 \def\pst@Coordinates{}
2204 \psLoop{#1}{\xdef\pst@Coordinates{\pst@Coordinates(#2;\the\psLoopIndex)}}
2205 \rput{\psk@rotate}(0,0){\expandafter\pspolygon\pst@Coordinates
2206 \multido{\nA=0+1}{#1}{\uput{\pslabelsep}[\nA]{*0}(#2;\nA){\psPutYLabel{\nA}}}}
2207 \endgroup%
2208 \ignorespaces}
2209 %
2210 \def\psKiviatLine{\pst@object{psKiviatLine}}
2211 \def\psKiviatLine@i#1{{%
2212 \addbefore@par{showpoints}%
2213 \use@par%
2214 \degrees[\pst@saveDegrees]%
2215 \psKiviatLine@ii#1\@nil}}%
2216 \def\psKiviatLine@ii#1,#2\@nil{%
2217 \global\pst@cntm=0
2218 \global\pst@cntn=1
2219 \begingroup
2220 \xdef\pst@saveCoors{}
2221 \psKiviatLine@iii#1,#2,#1,,\@nil
2222 \rput{\psk@@rotate}(0,0){\expandafter\pspolygon\pst@saveCoors}
2223 }
2224 \def\psKiviatLine@iii#1,#2,#3\@nil{%
2225 \ifx\relax#2\relax\else%\psline(#1;\the\pst@cntm)(#2;\the\pst@cntn)
2226 \xdef\pst@saveCoors{\pst@saveCoors(#1;\the\pst@cntm)}\fi
2227 \advance\pst@cntm\@ne
2228 \advance\pst@cntn\@ne
2229 \ifx\relax#3\relax\endgroup\else\psKiviatLine@iii#2,#3\@nil\fi}
2230 %
2231 \def\psKiviatTicklines{\pst@object{psKiviatTicklines}}
2232 \def\psKiviatTicklines@i#1#2{{% n, radius
2233 \degrees[#1]%
2234 \use@par%
2235 \pstFPDiv\pst@tempN{#2}{\psk@Dx}%
2236 \pst@cntm=\pst@tempN \advance\pst@cntm by \m@ne
2237 \multido{\rA=\psk@Dx+\psk@Dx}{\the\pst@cntm}{%
2238 \def\pst@Coordinates{}%
2239 \psLoop{#1}{\xdef\pst@Coordinates{\pst@Coordinates(\rA;\the\psLoopIndex)}}%
2240 \rput{\psk@@rotate}(0,0){\expandafter\pspolygon\pst@Coordinates}%
2241 }%
2242 }\ignorespaces}%
2243 %
2244 \def\psKiviatAxes{\pst@object{psKiviatAxes}}
2245 \def\psKiviatAxes@i#1#2{{%
2246 \degrees[#1]
2247 \use@par%
2248 \multido{\iA=0+1}{#1}{\rput{\psk@@rotate}(0,0){\psline(0,0)(#2;\iA)}}%
2249 }\ignorespaces}%
2250 %
2251 \define@key[psset]{pstricks-add}{colSteps}{\def\psk@colSteps{#1 }}
2252 \define@boolkey[psset]{pstricks-add}[Pst@]{colored}[true]{}
2253 \define@key[psset]{pstricks-add}{colorOffset}[]{\def\psk@colorOffset{#1 }}
2254 \psset[pstricks-add]{colSteps=0,colored=false,colorOffset=}% continuing colors and grayscale
2255 %
2256 \def\pstContour{\pst@object{pstContour}}
2257 \def\pstContour@i#1{%
2258 \addbefore@par{radius=1pt}
2259 \begin@SpecialObj%
2260 \pssetlength\pst@dimb\psk@radius
2261 \addto@pscode{
2262 (#1) run
2263 /zMax 0 def /zMin 0 def % lowest and highest value
2264 contourdata aload length /N_data ED % get the no of arrays
2265 N_data{ % inside contourdata
2266 /data ED % save first inner array
2267 data aload length 3 div round cvi { % get the records
2268 \psk@colorOffset
2269 dup zMin lt % z<zMin?
2270 { /zMin ED } % yes, save it
2271 { dup zMax gt { /zMax ED }{ pop } ifelse } ifelse
2272 pop pop % delete x y
2273 } repeat
2274 } repeat
2275 clear % clear stack
2276 /dz zMax zMin sub def % value range
2277 /steps \psk@colSteps\space 0 gt { true }{ false } ifelse def
2278 0 1 N_data 1 sub { % for i=0 to N-1
2279 contourdata exch get /data ED % get first array
2280 data aload length 3 div round cvi 1 sub { %0 .. length-1
2281 \psk@colorOffset
2282 /z_data ED /y_data ED /x_data ED
2283 z_data zMin sub dz div % relative z (0..1)
2284 \ifPst@colored 400 mul 380 add tx@addDict begin wavelengthToRGB
2285 Red Green Blue end setrgbcolor % set color
2286 \else
2287 steps {\psk@colSteps\space mul round \psk@colSteps\space div} if
2288 setgray
2289 \fi
2290 x_data \pst@number\psxunit mul y_data \pst@number\psyunit mul
2291 \pst@number\pst@dimb 0 360 arc fill
2292 } repeat
2293 } for
2294 }%
2295 \end@SpecialObj
2296 }
2297
2298 \newrgbcolor{OlympicRed}{0.87 0 0.14}
2299 \newrgbcolor{OlympicGreen}{0 0.62 0.24}
2300 \newrgbcolor{OlympicBlue}{0 0.52 0.78}
2301 \newrgbcolor{OlympicYellow}{0.96 0.78 0}
2302 %\definecolor{oblue}{rgb}{0,.52,.78}
2303 %\definecolor{oyellow}{rgb}{.96,.76,0}
2304 %\definecolor{ogreen}{rgb}{0,.62,.24}
2305 %\definecolor{ored}{rgb}{.87,0,.14}
2306
2307 \def\ps@lympicRing(#1)#2{%
2308 \rput(#1){%
2309 \pscircle[linewidth=0.25,linecolor=#2](0,0){1.375}%
2310 \pscircle[linewidth=0.05,linecolor=\pst@bgcolor](0,0){1.525}%
2311 \pscircle[linewidth=0.05,linecolor=\pst@bgcolor](0,0){1.225}}}
2312
2313 \def\ps@lympicArc(#1)#2#3#4{%
2314 \rput(#1){%
2315 \psarc[linewidth=0.25,linecolor=#2](0,0){1.375}{#3}{#4}%
2316 \psarc[linewidth=0.05,linecolor=\pst@bgcolor](0,0){1.525}{#3}{#4}%
2317 \psarc[linewidth=0.05,linecolor=\pst@bgcolor](0,0){1.225}{#3}{#4}}}
2318
2319 \def\psOlympicRings{\pst@object{psOlympicRings}}
2320
2321 \def\psOlympicRings@i(#1){%
2322 \pst@killglue
2323 \begingroup
2324 \addbefore@par{bgcolor=white,dimen=inner,psscale=1,dimen=middle}%
2325 \use@par
2326 \rput(#1){%
2327 \psscalebox{\psk@@psscale}{%
2328 \ps@lympicRing(-3.2,0){OlympicBlue}%
2329 \ps@lympicRing(-1.6,-1.375){OlympicYellow}%
2330 \ps@lympicArc(-3.2,0){OlympicBlue}{330}{30}%
2331 \ps@lympicRing(0,0){black}%
2332 \ps@lympicArc(-1.6,-1.375){OlympicYellow}{30}{90}%
2333 \ps@lympicRing(1.6,-1.375){OlympicGreen}%
2334 \ps@lympicArc(0,0){black}{330}{30}%
2335 \ps@lympicRing(3.2,0){OlympicRed}%
2336 \ps@lympicArc(1.6,-1.375){OlympicGreen}{30}{90}
2337 }%
2338 }%
2339 \endgroup
2340 }
2341
2342 \def\resetOptions{%
2343 \def\pst@linetype{0}%
2344 % \pstScalePoints(1,1){}{}%
2345 \psset[pstricks-add]{%
2346 randomPoints=1000,color=false,
2347 whichabs={},whichord={},
2348 plotfuncx={},plotfuncy={},buildvector=false,
2349 Derive={},adamsorder=4,
2350 Tnormal=false,
2351 braceWidth=2\pslinewidth,
2352 bracePos=0.5,
2353 braceWidthInner=10\pslinewidth,
2354 braceWidthOuter=10\pslinewidth,
2355 chartNodeI=0.75,
2356 chartNodeO=1.5,
2357 markAngle=false,
2358 colSteps=0,
2359 colored=false,
2360 randInit,
2361 }}
2362 %
2363 \resetOptions
2364 %
2365 \catcode`\@=\PstAtCode\relax
2366 %
2367 %% END: pstricks-add.tex
2368 \endinput