1 %% $Id: pstricks-add.tex 692 2012-06-04 06:47:40Z herbert $
4 %% This is file `pstricks-add.tex',
8 %% Package `pstricks-add.tex'
10 %% Dominique Rodriguez
11 %% Herbert Voss <hvoss@tug.org>
12 %% Michael Sharpe <msharpe@ucsd.edu>
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.
19 %% `pstricks-add' is a PSTricks package for additionals to the standard
22 \csname PSTricksAddLoaded
\endcsname
23 \let\PSTricksAddLoaded\endinput
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
34 \def\fileversion{3.58}
35 \def\filedate{2012/
06/
04}
36 \message{`pstricks-add' v
\fileversion,
\filedate\space (dr,hv)
}
38 \edef\PstAtCode{\the\catcode`\@
} \catcode`\@=
11\relax
40 \pst@addfams
{pstricks-add
}
42 %% prologue for postcript
43 \pstheader{pstricks-add.pro
}%
45 \def\psGetSlope(
#1,
#2)(
#3,
#4)
#5{% 4 values without a dimen! #5 is a macro
47 \advance\pst@dimm by -
#3pt
%
49 \advance\pst@dimn by -
#4pt
50 \pst@divide
{\pst@dimn
}{\pst@dimm
}#5}
52 \def\psGetDistance(
#1,
#2)(
#3,
#4)
#5{% 4 values without a dimen! #5 is a macro
54 \advance\pst@dimm by -
#3pt
%
56 \advance\pst@dimn by -
#4pt
57 \pst@pyth
\pst@dimm
\pst@dimn
\pst@dimo
58 \edef#5{\strip@pt
\pst@dimo
}
60 %--------------------------------------- small stuff -------------------------------
61 \define@boolkey
[psset
]{pstricks-add
}[Pst@
]{CMYK
}[true
]{}
62 \psset[pstricks-add
]{CMYK=true
}
64 \def\defineTColor{\@ifnextchar
[{\defineTColor@i
}{\defineTColor@i
[]}}
65 \def\defineTColor@i
[#1]#2#3{% "semi transparency colors"
68 fillstyle=vlines,hatchwidth=
0.1\pslinewidth,
69 hatchsep=
1\pslinewidth,hatchcolor=
#3}%
70 \ifx\pst@tempA\@empty
\else\psset{#1}\fi%
72 \defineTColor{TRed
}{red
}
73 \defineTColor{TGreen
}{green
}
74 \defineTColor{TBlue
}{blue
}
76 \def\rmultiput{\pst@object
{rmultiput
}}
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}}
86 % #1: (x,y) #2: rotAngle #3: object
87 \def\psrotate{\pst@object
{psrotate
}}
88 \def\psrotate@i(
#1)
#2{%
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
%
97 { \pst@tempA /yRot ED /xRot ED
98 \pst@tempB dup cos /cosA ED sin /sinA ED
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
}%
107 \pst@Verb
{ \tx@TMRestore
}\endgroup}
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{%
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{%
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
}
121 \pst@Verb
{ \tx@TMRestore
}%
124 \define@key
[psset
]{pstricks-add
}{intSeparator
}{\def\psk@intSeparator
{#1}}
125 \psset{intSeparator=
{,
}}
127 \def\psFormatInt{\def\pst@par
{}\pst@object
{psFormatInt
}}
128 \def\psFormatInt@i
#1{{%
131 \count1=
#1\count2=
\count1
132 \ifnum\count1=
0 0\else
135 \divide\count3 by
1000000
136 \the\count3\psk@intSeparator
\relax
137 \multiply\count3 by
1000000
138 \advance\count1 by -
\count3 % modulo 1000000
142 \divide\count3 by
1000
144 \ifnum\count3<
100 0\fi
145 \ifnum\count3<
10 0\fi
147 \the\count3\psk@intSeparator
\relax
148 \multiply\count3 by
1000
149 \advance\count1 by -
\count3 %modulo 1000
152 \ifnum\count1<
100 0\fi
153 \ifnum\count1<
10 0\fi
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
}
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
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
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
185 [ Alpha cos Alpha sin Alpha sin neg Alpha cos
\pst@tempA
] concat
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
202 \ifx\psk@fillstyle
\relax\else
204 ifStar
{ \pst@usecolor
\pslinecolor }{ \pst@usecolor
\psfillcolor } ifelse
208 \pst@number
\pslinewidth setlinewidth
\pst@usecolor
\pslinecolor stroke
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}
221 \newdimen\psparallelogramsep
222 \define@key
[psset
]{pstricks-add
}{parallelogramsep
}[3mm
]{\pssetlength\psparallelogramsep{#1}}
223 \psset[pstricks-add
]{parallelogramsep=
3mm
}
225 \def\psparallelogrambox{\pst@object
{psparallelogrambox
}}
226 \def\psparallelogrambox@i
{\pst@makebox
\psparallelogrambox@ii
}
227 \def\psparallelogrambox@ii
{%
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
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
250 % D.G. modification begin - Nov. 28, 2001
252 \pst@number
\psparallelogramsep
254 % D.G. modification end
256 \def\pst@linetype
{2}%
260 \ifpsboxsep\kern\pst@dima
\fi%
262 \ifpsboxsep\dp\pst@hbox=
\pst@dimb
\ht\pst@hbox=
\pst@dimd
\fi
263 \leavevmode\box\pst@hbox
267 % From the Frame and Rect PostScript macros
268 \pst@def
{Parallelogram
}<
{%
270 % Dirk Osburg modification begin - Jul. 16, 2011
272 %x1 pgs sub y1 moveto
274 %x2 pgs add y2 lineto
276 %x1 pgs sub y1 lineto
277 %%%% replaced by: %%%
283 % Dirk Osburg modification end
290 2 copy gt
{ exch
} if
295 2 copy gt
{ exch
} if
300 1 index
0 eq
{pop pop ParallelogramA
} { OvalFrame
} ifelse
}>
303 % -------------- the arrow part -------------
305 % \def\pst@arrowtable{,<->,<<->>,>-<,>>-<<,(-),[-],)-(,]-[,|>-<|}
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
}
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
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
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
345 { closepath gsave fill grestore
} if
% if filled : close and fill
346 \@nameuse
{psls@
\psarrowlinestyle}
348 0 t
{ y
2 mul
} { 0 } ifelse moveto>
% if outside : twice longer line
350 % VeeArrow : filled? outside? (total) angle (projected) length (arrow) line width
353 false false
\psk@veearrowangle
\psk@veearrowlength
\psk@veearrowlinewidth
\tx@VeeArrow
}
355 false true
\psk@veearrowangle
\psk@veearrowlength
\psk@veearrowlinewidth
\tx@VeeArrow
}
357 true false
\psk@filledveearrowangle
\psk@filledveearrowlength
\psk@filledveearrowlinewidth
\tx@VeeArrow
}
359 true true
\psk@filledveearrowangle
\psk@filledveearrowlength
\psk@filledveearrowlinewidth
\tx@VeeArrow
}
361 % And An another arrowhead
362 % architectural tick / oblique 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
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
379 \@nameuse
{psls@
\psarrowlinestyle}
383 \@namedef
{psas@t
}{ false
\psk@tickarrowlength
\psk@tickarrowlinewidth
\tx@TickArrow
}
384 \@namedef
{psas@T
}{ true
\psk@tickarrowlength
\psk@tickarrowlinewidth
\tx@TickArrow
}
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}
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
400 /z CLW
2 div def
% save it
401 x y moveto
% goto first point
403 curveto
% draw Bezier
405 0 y moveto
% define current point
407 \pst@number
\pshooklength
408 \pst@number
\pshookwidth
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)
418 w neg h abs moveto
0 0 L
422 0 \psk@arrowlength
\psk@arrowsize
\tx@Rhook
424 % New parameter "arrowfill", with default as "true"
425 \define@boolkey
[psset
]{pstricks-add
}[ps
]{ArrowFill
}[true
]{}
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)
430 CLW mul add dup
2 div
433 /a ED
{ 0 h T
1 -
1 scale
} if
435 \ifpsArrowFill\else\pst@number
\pslinewidth \pst@arrowscale
\space div SLW
\fi
437 0 0 L w h L w neg a neg rlineto
438 \ifpsArrowFill gsave fill grestore
\else gsave closepath stroke grestore
\fi
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}}
449 \psk@nArrowsA
\space 1 sub
{
450 false
\psk@arrowinset
\psk@arrowlength
\psk@arrowsize
\tx@Arrow
455 false
\psk@arrowinset
\psk@arrowlength
\psk@arrowsize
\tx@Arrow
462 true
\psk@arrowinset
\psk@arrowlength
\psk@arrowsize
\tx@Arrow
464 \psk@nArrowsB
\space 2 sub
{
465 false
\psk@arrowinset
\psk@arrowlength
\psk@arrowsize
\tx@Arrow
468 false
\psk@arrowinset
\psk@arrowlength
\psk@arrowsize
\tx@Arrow
469 0 h a
5 mul
2 div sub moveto
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
{} %
480 \xdef\pst@tempg
{<
#1}%
482 \expandafter\psset@@ArrowInside
\pst@tempg\@empty-\@empty\@nil
%
483 \if@pst
\else\@pstrickserr
{Bad intermediate arrow specification:
#1}\@ehpa
\fi%
486 % Adapted from \psset@@arrows
487 \def\psset@@ArrowInside
#1-
#2\@empty
#3\@nil
{%
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}}%
495 % Default value empty
496 \psset{ArrowInside=
{}}
497 % Modified version of \pst@addarrowdef
498 \def\pst@addarrowdef
{%
501 \ifx\psk@arrowA\@empty
508 /ArrowB
{ \ifx\psk@arrowB\@empty
\else \pst@arrowdef
{B
} \fi } def
511 \ifx\psk@ArrowInside\@empty
\else \pst@arrowdefA
{Inside
} \fi
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
520 \@nameuse
{psas@\@nameuse
{psk@Arrow
#1}}
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}
528 % Redefinition of the PostScript /Line macro to print the intermediate
529 % arrow on each segment of the line
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}
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
542 \psk@arrowsize
\space CLW mul add dup
\psk@arrowlength
\space mul exch
\psk@arrowinset mul neg add
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
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
555 /y1 ED /x1 ED /y2 ED /x2 ED
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
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
585 }{ ArrowA /n n
2 sub def n
{ Lineto
} repeat
} ifelse
586 CP
4 2 roll ArrowB L pop pop
} if >
588 % Redefinition of the PostScript /Polygon macro to print the intermediate
589 % arrow on each segment of the line
591 NArray n
2 eq
{ 0 0 /n
3 def
} if
595 n
3 gt
{ CheckClosed
} if
604 /x1 x0 x1 add
2 div def
605 /y1 y0 y1 add
2 div def
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
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
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
640 /y11 ED /x11 ED /y12 ED /x12 ED
646 /y11 ED /x11 ED /y12 y0 def /x12 x0 def
648 /y11 y0 def /x11 x0 def /y12 yy1 def /x12 xx1 def
656 % Redefinition of the PostScript /OpenBezier macro to print the intermediate
658 \pst@def
{OpenBezier
}<
{%
659 /dArrowPos
\psk@ArrowInsideNo
1 gt
{%
660 1.0 \psk@ArrowInsideNo
1.0 add div
661 }{ \psk@ArrowInsidePos
} ifelse def
667 n
4 sub
3 idiv
{ 6 2 roll
4 2 roll curveto
} repeat
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
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
686 3 -
1 roll sub
3 1 roll sub Pyth
698 /ende
\psk@ArrowInsidePos
\space 1 gt
700 {ArrowPos CurveLength mul
} ifelse def
707 /sum getdL sum add def
708 sum ende gt
{exit
} if
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
716 /ArrowPos ArrowPos dArrowPos add def
720 ArrowInside pop pop pop pop
722 x1 y1 x2 y2 x3 y3 curveto
726 % Redefinition of the PostScript /NCLine macro to print the intermediate
731 ArrowA CP
4 2 roll ArrowB
733 /y2 ED /x2 ED /y1 ED /x1 ED
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
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
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
761 pop pop lineto pop pop
767 xA1 xB1 sub yA1 yB1 sub
768 Pyth
2 div dup
3 -
1 roll mul
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
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
800 3 -
1 roll sub
3 1 roll sub Pyth
812 /ende
\psk@ArrowInsidePos
\space 1 gt
{ArrowPos
}{ArrowPos CurveLength mul
} ifelse def
820 /sum getdL sum add def
821 sum ende gt
{exit
} if
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
832 /ArrowPos ArrowPos dArrowPos add def
836 ArrowInside pop pop pop pop
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
845 \def\parseRP#1;
#2;
#3\@nil
{%check whether arg of refpt contains ;
846 \def\arg@A
{#1}\def\arg@B
{#2}}
848 \def\Put{\pst@object
{Put
}}%
849 \def\Put@i
{\@ifnextchar(
{\Put@ii
{}}{\Put@ii
}}%
850 \def\Put@ii
#1(
#2)
#3{{%
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}
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}
864 % Modify pst@rot so that a rotation may be specified with a node or ps code
866 \define@key
[psset
]{pstricks-add
}{Os
}[0]{\def\PST@Os
{#1}}
868 \define@key
[psset
]{pstricks-add
}{Ds
}[1]{\def\PST@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,
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
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
}%
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
%
909 \expandafter\xdef \csname #4pointcount
\endcsname {\psk@plotpoints
}%
910 % \typeout{Created points #40 .. #4\psk@plotpoints}%
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}[]}}%
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}%
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
%
931 \ifPST@metricFunction
932 0 1 #1.X length
1 sub
{
934 #1.X j get /x ED
#1.Y j get /y ED Func put
936 \else %build by increments
937 sarray
0 \PST@metricInitValue
\space put
%
938 1 1 #1.X length
1 sub
{
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
947 \fi %\ifPSTfunctionMetric
950 /tmpar
[(Metric range:
[) () (, ) () (
])
] def
%
951 tmpar
1 sarray
0 get str cvs put
953 tmpar
3 sarray
\the\pst@cntC
\space get str cvs put tmpar
954 tx@NodeDict begin concatstringarray = end
%
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
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
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
%
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
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}}%
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
}
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{%
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
1015 \pst@tempA
\space /yMin exch def
1017 \pst@tempB
\space /yMax 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
}
1026 \ifPst@
color getRandReal getRandReal getRandReal setrgbcolor
\fi
1027 getRandReal dx mul xMin add
1028 getRandReal dy mul yMin add
1030 \ifx\psk@fillstyle
\psfs@solid fill
\fi stroke
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}%
1055 \pst@ConnectionCommand
{comment@
1}{comment@
2}
1056 \if@star
\pst@PutCommand*(
#1)
{#3}\else\pst@PutCommand(
#1)
{#3}\fi
1061 \def\tx@MovetoByHand
{ tx@addDict begin MovetoByHand end
}
1062 \def\tx@LinetoByHand
{ tx@addDict begin LinetoByHand end
}
1066 \def\pslineByHand{\def\pst@par
{}\pst@object
{pslineByHand
}}
1067 \def\pslineByHand@i
{%
1068 \addbefore@par
{VarStepEpsilon=
2,varsteptol=
0.8}
1071 \pst@getcoors
[\pslineByHand@ii
}}
1072 \def\pslineByHand@ii
{%
1075 /dtHand
\psk@VarStepEpsilon
\space def
1076 /amplHand
\psk@varsteptol
\space def
1077 % \pst@cp % current point
1078 \tx@setlinejoin
% hv 2007-10-13
1080 counttomark
2 div /maxLines ED
1081 1 1 maxLines
{ pop LinetoByHand
} for
1087 \def\psRelNode{\pst@object
{psRelNode
}}
1088 \def\psRelNode@i(
#1)(
#2)
#3#4{{% A - B - factor - node name
1090 \pst@getcoor
{#1}\pst@tempA
%
1091 \pst@getcoor
{#2}\pst@tempB
%
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
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}%
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}%
1115 \def\psRelLine@iii(
#1)(
#2)
#3#4{{
1118 \psRelNode(
#1)(
#2)
{#3}{#4}
1123 % draw a parallel line to #2 #3
1125 % #4----------#5(new node)
1126 % #5 length of the line
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{{
1134 \pst@getcoor
{#1}\pst@tempA
1135 \pst@getcoor
{#2}\pst@tempB
1136 \pst@getcoor
{#3}\pst@tempC
1137 % \pst@getlength{#4}\pst@dima
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
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}%
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
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
1175 XA dup XC sub m2 mul YC add
1179 XC dup XA sub m1 mul YA add
1183 m1 XA mul m2 XC mul sub YA sub YC add m1 m2 sub div dup
1184 XA sub m1 mul YA add
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
{%
1202 \expandafter\psDefPSPNodes@ii
\pic@coor
}
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
}
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
]{}%
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
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
1242 \def\psStep{\def\pst@par
{}\pst@object
{psStep
}}
1243 \def\psStep@i(
#1,
#2)
#3#4{%
1246 \ifPst@algebraic /Func (
#4) tx@addDict begin AlgParser end cvx def
\fi
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)
1254 \ifPst@algebraic Func
\else #4 \fi scy dup x scx exch lineto
1256 x scx exch lineto x scx
0 lineto
1258 \or % 1-> upper, height is always f(x+dx)
1262 \ifPst@algebraic Func
\else #4 \fi scy dup x dx sub scx exch lineto
1263 x scx exch lineto x scx
0 lineto
1272 /Max
\ifPst@algebraic Func
\else #4 \fi def
1274 /t x def
% save x value
1276 \ifPst@algebraic Func
\else #4 \fi
1278 Max lt
{ /Max exch def
} { dup Min gt
{ /Min exch def
}{ pop
} ifelse
} ifelse
1282 x scx Min scy Max scy xMinMax aload length
3 add array astore /xMinMax exch 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
1293 \ifPst@algebraic Func
\else #4 \fi /y0 ED
% left value f(x)
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
1301 \or % 4-> sup(remum)
1304 \ifPst@algebraic Func
\else #4 \fi /y0 ED
% left value f(x)
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
1318 \define@key
[psset
]{pstricks-add
}{Derive
}{\def\psk@Derive
{#1}}%
1319 \define@boolkey
[psset
]{pstricks-add
}[PST@
]{Tnormal
}[true
]{}
1321 \psset[pstricks-add
]{CMYK=true
}
1322 \def\@NOTEMPTY
{NOT@EMPTY
}%%dr 0606
1324 \def\psTangentLine{\def\pst@par
{}\pst@object
{psTangentLine
}}
1325 \def\psTangentLine@i(
#1,
#2)(
#3,
#4)(
#5,
#6)
#7#8{%
1328 [[#1 dup dup mul exch
1 #2]
1329 [#3 dup dup mul exch
1 #4]
1330 [#5 dup dup mul exch
1 #6]]
1333 abc aload pop
% a b c on stack
1335 mul add exch
% c+b*x a
1336 #7 dup mul mul add
% a*x^2+b*x+c
1338 abc aload pop pop exch
% b a
1339 #7 mul
2 mul add
% b+2*a*x0=mTan
1341 neg
1 exch div
% -1/mTan=mOrth
1342 #8 mul /dy ED
% mOrth*dx=dy
1344 #7 #8 add y0 dy add
\tx@ScreenCoor
% x0+dx y0 +dy
1345 #7 y0
\tx@ScreenCoor
% x0 y0
1348 #8 mul /dy1 ED
% mTan*dx
1349 #8 neg mul /dy2 ED
% mTan*-dx
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
1354 /Lineto /lineto load def
1355 \ifshowpoints true
\else false
\fi
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
1365 mul add exch
% c+b*x a
1366 #7 dup mul mul add
% a*x^2+b*x+c
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
1374 mul add exch
% c+b*x a
1375 #7 dup mul mul add
% a*x^2+b*x+c
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
1384 [[#1 dup dup mul exch
1 #2][#3 dup dup mul exch
1 #4][#5 dup dup mul exch
1 #6]]
1387 abc aload pop
% a b c on stack
1389 mul add exch
% c+b*x a
1390 #7 dup mul mul add
% a*x^2+b*x+c
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
}%
1398 \def\psplotTangent@x
#1,
#2,
#3\@nil
{%
1399 \def\pst@tempLeft
{#1}%
1400 \def\pst@tempRight
{#2}}
1402 %% #2 : delta x or x0,x1
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{%
1408 \expandafter\psplotTangent@x
#3,,\@nil
\relax
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
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
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
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
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
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
1448 y2 y1 sub x2 x1 sub
} % dy dx
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
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
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
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
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
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
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
1488 \ifx\pst@tempRight\@empty
#3 neg
\else \pst@tempLeft
\space \fi
1489 \pst@number
\psxunit mul
1492 \pst@usecolor
\pslinecolor
1493 false
% don't show the points
1495 \ifx\pslinestyle\@none
\else
1496 \pst@number
\pslinewidth SLW
1497 \tx@setStrokeTransparency
1498 \@nameuse
{psls@
\pslinestyle}
1500 \ifshowpoints % show the points?
1503 \@nameuse
{psds@
\psk@dotstyle
}
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)
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
}
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
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
1536 \def\EndSaveFinalState{\pstverb{\End@SaveFinalState
}}
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}%
1544 \@nameuse
{beginplot@
\psplotstyle}%
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
1556 ylength i sub
2 add -
1 roll add ylength
2 mul i sub
1 roll
1559 /dx x1 x sub
\psk@plotpoints
\space div def
1563 dup
4 -
1 roll mul
2 index
2 add
1 roll
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
1570 \ifPst@algebraic F@pstplot ylength array astore
1572 \ifPst@buildvector
\else y aload pop
\fi #4
1573 \ifPst@buildvector
\else ylength array astore
\fi
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
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
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
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
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
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
1620 \else %% RUNGE-KUTTA & ADAMS methods
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
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
1635 \ifx\psk@method\@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)
}
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
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
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
1667 y aload pop addvect ylength array astore /y exch def
} def
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
1679 \ifx\psk@method\@varrkiv
%% RUNGE-KUTTA method
1681 \else\ifx\psk@method\@rkiv
%% RUNGE-KUTTA method
1684 /F1 F2 def /F2 F3 def /F3 F4 def /F4
%% ADAMS method
1685 \ifcase\psk@adamsorder
\or\or\or\or
1693 F5 def /F5 F6 def /F6 Func def
1695 INIT
\psk@adamsorder
\space lt
1696 { RK /INIT INIT
1 add def
}
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
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
1715 \gdef\psplot@init
{}%
1717 \@nameuse
{testqp@
\psplotstyle}%
1718 \if@pst
\psplot@ii
\else\psplot@iii
\fi
1719 % \addto@pscode{\ifPst@saveData Pst@data closefile \fi}
1725 \def\psGTriangle{\def\pst@par
{}\pst@object
{psGTriangle
}}
1726 \def\psGTriangle@i(
#1)(
#2)(
#3)
#4#5#6{{%
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
1738 \psk@gangle
% rotating angle
1739 \pst@tempA
% A, temporary origin
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
1747 \if@star
\pspolygon[fillstyle=none
](
#1)(
#2)(
#3)
\fi% draw borderline
1748 \def\pst@linetype
{2}%
1752 \def\psdice{\def\pst@par
{}\pst@object
{psdice
}}
1755 \addbefore@par
{framearc=
0.3,linewidth=
1pt
}%
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
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}%
1770 % the datafile must be a matrix with
1776 \def\pswavelengthToGRAY{ tx@addDict begin wavelengthToGRAY end
}
1777 \def\pswavelengthToRGB{ tx@addDict begin wavelengthToRGB Red Green Blue end
}
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{%
1795 \addbefore@par
{xStep=
1,yStep=
1}%
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
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
1814 Min sub dMaxMin div
300 mul
400 add
1815 \pswavelengthToRGB setrgbcolor
1817 Min sub dMaxMin div neg
1 add
300 mul
400 add
1818 \pswavelengthToRGB setrgbcolor
1820 Min sub dMaxMin div neg
1 add
300 mul
400 add
1821 \pswavelengthToGRAY setgray
1823 Min sub dMaxMin div neg
1 add
300 mul
400 add
1824 \pswavelengthToGRAY neg
1 add setgray
1826 currentdict /colorTypeDef known
{ colorTypeDef
} { \psk@colorTypeDef
} ifelse
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
1841 \newdimen\chart@ColorIndex
1842 \newdimen\chart@ColorStep
1843 \newdimen\pst@chartHeight
1844 \newdimen\pst@chartStackDepth
1845 \newdimen\pst@chartStackWidth
1846 \newcount\chart@Toggle
1848 \newif\if@chartUserColor
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
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
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,
%
1867 \define@key
[psset
]{pstricks-add
}{userColor
}{%
1868 \chart@Toggle=
0\relax%
1869 \def\chart@option
{#1}%
1870 \ifx\chart@option\@empty\@chartUserColorfalse
%
1872 \@chartUserColortrue
%
1873 \expandafter\psk@@chartUserColor
#1,,\@nil
%
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=
{}}
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}
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
1891 \global\pssetylength\pst@chartHeight
{#3}%
1892 \global\let\pst@chartRadius
\pst@chartHeight
%
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%
1905 \addbefore@par
{dimen=outer
}%
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
}%
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}%
1933 \pswedge(
\psk@chartSep
\p@;
\pst@number
\pst@dimo)
{\pst@chartRadius
}{\pst@number
\pst@dimn
}{\pst@number
\pst@dimm
}%
1935 \pswedge(
0,
0)
{\pst@chartRadius
}{\pst@number
\pst@dimn
}{\pst@number
\pst@dimm
}%
1937 \global\let\chart@alpha
\chart@tempA
%
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%
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}%
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
}%
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
}%
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
%
1984 \global\chart@Toggle=
0%
1985 \global\advance\chart@ColorIndex by -
\chart@ColorStep
%
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%
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
2023 \global\chart@Toggle=
0
2024 \global\advance\chart@ColorIndex by -
\chart@ColorStep
%
2029 \def\pst@stackList
{}
2030 \def\addbefore@stackList
#1{%
2031 \ifx\pst@stackList\@empty
2032 \xdef\pst@stackList
{#1}%
2035 \pst@toks
\expandafter{\pst@stackList
}%
2036 \xdef\pst@stackList
{\the\toks@,
\the\pst@toks
}%
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
}%
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@
%
2080 \rput(
\the\pst@dima,
\the\pst@dimb)
{\pscs@Histogram@i
{\chart@tempB
}}
2081 \advance\pst@cnto by
\m@ne
% decrease stack counter
2083 \advance\pst@cntn by
\tw@
% increase
2084 \def\pst@stackList
{}% reset stack list
2085 \pst@cnto=
0 % reset stack counter
2088 \pscs@Histogram@i
{\chart@tempA
}% non stacked version
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%
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
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
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
2125 \global\chart@Toggle=
0
2126 \global\advance\chart@ColorIndex by -
\chart@ColorStep
%
2128 \global\advance\chart@ColorIndex by
1pt
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
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
}
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
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
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
2165 2 copy gt
{ exch
} if
2168 pop pop
% delete arc values
2169 \ifnum\psk@cancelType<
\tw@
% / or x
2173 \ifnum\psk@cancelType=\@ne
\else % \ or x
2179 \def\pst@linetype
{2}%
2183 \ifpsboxsep\kern\pst@dima
\fi%
2185 \ifpsboxsep\dp\pst@hbox=
\pst@dimb
\ht\pst@hbox=
\pst@dimd
\fi
2186 \leavevmode\box\pst@hbox
2190 \newcount\psVectorCtr
2191 \define@boolkey
[psset
]{pstricks-add
}[Pst@
]{markAngle
}[true
]{}
2192 \psset[pstricks-add
]{markAngle=false
}
2194 \newpsstyle{psMarkAngleStyle
}{arrows=->,arrowsize=
4pt
}
2195 \newpsstyle{psMarkAngleLineStyle
}{linestyle=dotted,arrows=-
}
2197 \def\psStartPoint{\@ifnextchar
[{\psStartPoint@i
}{\psStartPoint@i
[Vector
]}}
2198 \def\psStartPoint@i
[#1](
#2)
{%
2199 \global\psVectorCtr=\@ne
2200 \gdef\psVectorName{#1}
2202 \pst@getcoor
{#2}\pst@tempA
%
2203 \pstVerb{tx@Dict begin
2205 \pst@number
\psyunit div /cp.Y exch def
2206 \pst@number
\psxunit div /cp.X exch def end
}}
2208 \def\psVector{\pst@object
{psVector
}}
2209 \def\psVector@i(
#1)
{%
2211 \addbefore@par
{arrows=->,arrowsize=
6pt
}%
2212 \pst@getcoor
{#1}\pst@tempCoor
%
2215 \rput(! cp.X cp.Y )
{%
2218 \psarc[style=psMarkAngleStyle
](
0,
0)
{1}{0}{!
\pst@tempCoor exch atan
}%
2219 \psline[style=psMarkAngleLineStyle
](
1.5,
0)
%
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
%
2225 \pst@Verb
{%tx@Dict begin
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
2232 \define@key
[psset
]{pstricks-add
}{basename
}{\def\psk@basename
{#1}}%
2233 \psset[pstricks-add
]{basename=
}%
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}
2240 \pst@getlength
{#3}\pst@LengthA
%
2241 \addbefore@par
{basename=CircleT
}%
2243 \edef\@cmd
{\noexpand\psEllipseTangentsN(
#2)(!
\pst@LengthA dup
%
2244 \pst@number
\psxunit div exch
\pst@number
\psyunit div )(
#1)
{\psk@basename
}}%
2249 \def\psCircleTangents@iii(
#1)
#2(
#3)
#4{% two circles--- (Cntr1){radius1}(Cntr2){radius2}
2252 \pst@getlength
{#2}\pst@LengthA
% radius1
2253 \pst@getlength
{#4}\pst@LengthB
% radius2
2254 \addbefore@par
{basename=CircleT
}%
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
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
}%
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
}%
2278 \def\psEllipseTangents{\pst@object
{psEllipseTangents
}}
2279 \def\psEllipseTangents@i(
#1)(
#2)(
#3)
{% (Center)(axes)(viewpoint)
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}%
2286 \def\psEllipseTangentsN(
#1)(
#2)(
#3)
#4{% (xe,ye)(a,b)(xP,yP){basename} % no optional arguments
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
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}%
2321 \define@key
[psset
]{pstricks-add
}{rotate
}{\def\psk@rotate
{#1 }}
2322 \psset[pstricks-add
]{rotate=
0}
2324 \def\pst@saveDegrees
{}
2326 \def\psKiviat{\pst@object
{psKiviat
}}
2327 \def\psKiviat@i
#1#2{% #1: number of edges #2 radius
2328 \gdef\pst@saveDegrees
{#1}
2332 \addbefore@par
{rotate=
0}
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}}}}
2342 \def\psKiviatLine{\pst@object
{psKiviatLine
}}
2343 \def\psKiviatLine@i
#1{{%
2344 \addbefore@par
{showpoints
}%
2346 \degrees[\pst@saveDegrees
]%
2347 \psKiviatLine@ii
#1\@nil
}}%
2348 \def\psKiviatLine@ii
#1,
#2\@nil
{%
2352 \xdef\pst@saveCoors
{}
2353 \psKiviatLine@iii
#1,
#2,
#1,,\@nil
2354 \rput{\psk@@rotate
}(
0,
0)
{\expandafter\pspolygon\pst@saveCoors
}
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}
2363 \def\psKiviatTicklines{\pst@object
{psKiviatTicklines
}}
2364 \def\psKiviatTicklines@i
#1#2{{% n, radius
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
}%
2376 \def\psKiviatAxes{\pst@object
{psKiviatAxes
}}
2377 \def\psKiviatAxes@i
#1#2{{%
2380 \multido{\iA=
0+
1}{#1}{\rput{\psk@@rotate
}(
0,
0)
{\psline(
0,
0)(
#2;
\iA)
}}%
2384 \def\pst@linetype
{0}%
2385 \pstScalePoints(
1,
1)
{}{}%
2386 \psset[pstricks-add
]{%
2387 hooklength=
3mm, hookwidth=
1mm,
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,
2396 braceWidth=
2\pslinewidth,
2398 braceWidthInner=
10\pslinewidth,
2399 braceWidthOuter=
10\pslinewidth,
2407 \catcode`\@=
\PstAtCode\relax
2409 %% END: pstricks-add.tex