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

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.