Debian Codegraph @

texmf-dist/dvips/pstricks/pstricks.pro

raw
1 % $Id: pstricks.pro 1107 2025-06-12 12:30:06Z herbert $
2 %
3 %% PostScript prologue for pstricks.tex.
4 %% Version 1.41, 2021/11/16
5 %%
6 %% This program can be redistributed and/or modified under the terms
7 %% of the LaTeX Project Public License Distributed from CTAN archives
8 %% in directory macros/latex/base/lppl.txt.
9 %
10 %
11 % Define the follwing gs-functions if not known, eg when using distiller
12 %
13 revision 952 gt
14 {
15 systemdict /.setopacityalpha known not
16 {
17 (\n\n%%%% WARNING: Transparency operations ignored - need to use -dALLOWPSTRANSPARENCY\n\n) print flush
18 /.setopacityalpha { pop } bind def
19 /.setshapealpha { pop } bind def
20 /.setfillconstantalpha { pop } bind def
21 /.setstrokeconstantalpha { pop } bind def
22 }
23 {
24 /.setopacityalpha /.setfillconstantalpha load def
25 % /.setblendmode { pop } def %% works again hv 20210825
26 /.setshapealpha {dup .setfillconstantalpha .setstrokeconstantalpha true .setalphaisshape } def
27 } ifelse
28 }
29 {
30 systemdict /.setopacityalpha known not
31 {
32 (\n\n%%%% WARNING: Transparency operations ignored - need to use -dNOSAFER\n\n) print flush
33 /.setopacityalpha { pop } bind def
34 /.setshapealpha { pop } bind def
35 } if
36 } ifelse
37 %
38 %%<bool> .setalphaisshape -
39 %% If true, the values set by setstrokeconstantalpha and setfillconstantalpha are interpreted as shape values. The initial value of the AIS flag is false.
40 %
41 %
42 /tx@Dict 200 dict def % the main PSTricks dictionary
43 tx@Dict begin
44 /ADict 25 dict def % The arrow dictionary
45 /fill@Dict 30 dict def % the fill dictionary
46 /CM { matrix currentmatrix } bind def
47 /SLW /setlinewidth load def
48 /CLW /currentlinewidth load def
49 /CP /currentpoint load def
50 /ED { exch def } bind def
51 /L /lineto load def
52 /T /translate load def
53 /TMatrix { } def
54 /RAngle { 0 } def
55 /Sqrt { dup 0 lt { pop 0 } { sqrt } ifelse } def % return 0 for negative arguments
56 /Atan { /atan load stopped { pop pop 0 } if } def % return 0 if atan not known
57 /ATAN1 {neg -1 atan 180 sub } def % atan(x) (only one parameter)
58 /Div { dup 0 eq { pop } { div } ifelse } def % control the division
59 /Log { dup 1e-20 lt { pop -1e30 }{ log } ifelse } def % control the log
60 /tan { dup cos abs 1.e-10 lt
61 { pop 1.e10 } % return 1.e10 as infinit
62 { dup sin exch cos div } ifelse % default sin/cos
63 } def
64 /Tan { dup sin exch cos Div } def % sin(x)/cos(x) x in degrees
65 /Acos {dup dup mul neg 1 add dup 0 lt { % arc cos, returns 0 when negative root
66 pop pop 0 }{ sqrt exch atan} ifelse } def
67 /Acos2 { 2 dict begin
68 /x ED /y ED
69 y abs 1.0e-20 lt { 1.0e30 } if
70 x y div
71 dup dup mul neg 1 add dup 0 lt { % arc cos needs two values x,y
72 pop pop 0 }{ sqrt exch atan} ifelse
73 y 0 lt { 180 add } if
74 } def
75 /Power { % a^b latest ghostscript don't allow -4^-3.1
76 2 dict begin % hold all local
77 /b ED
78 /a ED
79 a 0 lt % prevent something like (-4)^(-3.1)=> 1/(-4)^3
80 { b 0 lt
81 { a b cvi exp }
82 { a b exp } ifelse
83 }
84 { a 0 eq { 0 }{ a b exp } ifelse
85 } ifelse
86 end
87 } def
88 %
89 /NET { neg exch neg exch T } def % change coordinate system to the negative one
90 /Pyth { dup mul exch dup mul add sqrt } def % Pythagoras, expects 2 parameter
91 /addCoors {
92 3 -1 roll % xA xB yB yA
93 add % xA xB yB+yA
94 3 1 roll % yB+yA xA xB
95 add % yB+yA xA+xB
96 exch % xA+xB yA+yB
97 } def
98 /Pyth2 { % Pythagoras, xA yA xB yB
99 3 -1 roll % xA xB yB yA
100 sub % xA xB yB-yA
101 3 1 roll % yB-yA xA xB
102 sub % yB-yA xA-xB
103 Pyth } def
104 %
105 /CtoP { 2 copy % x y x y
106 dup mul % x y x y^2
107 exch dup mul % x y y^2 x^2
108 add sqrt % x y r
109 3 1 roll exch % r y x
110 Tan % r angle
111 } def
112 /PtoC { 2 copy cos mul 3 1 roll sin mul } def % Polar to Cartesian (original)
113 /PtoCrel { pst@angleunit PtoC } def % Polar to Cartesian with \degrees[??]
114 /PtoCab { dup cos 4 -1 roll mul 3 1 roll sin mul } def % Polar to Cartesian (Ellipse) a b phi-> x y
115 /AnytoDeg { pst@angleunit } def
116 /DegtoAny { 1 pst@angleunit div} def
117 /AnytoRad { AnytoDeg DegtoRad } def
118 /RadtoAny { RadtoDeg DegtoAny } def
119 %
120 %/Rand { rand 4294967295 div } def % a real random number
121 /Rand { rand 2147483447 div } def % a real random number between 0 and 1
122 %----------------- hv added 20050516 ---------------
123 /PiDiv2 1.57079632680 def
124 /Pi 3.14159265359 def
125 /TwoPi 6.28318530718 def
126 /Euler 2.71828182846 def
127 %/e Euler bind def
128 %
129 /RadtoDeg { 180 mul Pi div } bind def % convert from radian to degrees
130 /DegtoRad { Pi mul 180 div } bind def % viceversa
131 %
132 /startGlobal { true setglobal globaldict begin } bind def
133 /endGlobal { end false setglobal } bind def
134 %
135 /pssetRGBcolor /setrgbcolor load def
136 /pssetCMYKcolor /setcmykcolor load def
137 /pssetGraycolor /setgray load def
138 %
139 %----------------- hv end---------------------------
140 /PathLength@ { /z z y y1 sub x x1 sub Pyth add def /y1 y def /x1 x def } def
141 %
142 /PathLength {
143 10 dict begin
144 flattenpath /z 0 def
145 { /y1 ED /x1 ED /y2 y1 def /x2 x1 def }
146 { /y ED /x ED PathLength@ }
147 {}
148 { /y y2 def /x x2 def PathLength@ }
149 /pathforall load stopped { pop pop pop pop } if
150 z
151 end
152 } def
153 %
154 /STP { .996264 dup scale } def % BP/PT scaling
155 /STV { SDict begin normalscale end STP } def %
156 %
157 /DashLine {
158 dup 0 gt
159 { /a .5 def PathLength exch div }
160 { pop /a 1 def PathLength } ifelse
161 /b ED % pattern should fit evenly in b
162 dup /X ED % pattern array
163 0 get /y ED % length of first black segment
164 /z 0 X {add} forall def % length of the full pattern
165 %% Computation of the scaling factor as described by van Zandt:
166 b a .5 sub 2 mul y mul sub z Div round
167 z mul a .5 sub 2 mul y mul add b exch Div
168 %%%% scaling factor on stack.
169 /z ED %% now, z is the scaling factor
170 false % for the length test below
171 X { z mul } forall X astore %% modification TN 04-08-07
172 %%% Checking whether at least one dash in X has positive length:
173 {0 gt or} forall
174 { X 1 a sub y mul }
175 { [ 1 0 ] 0 }
176 ifelse
177 setdash stroke
178 } def
179 %
180 /DotLine {
181 /b PathLength def
182 /a ED /z ED /y CLW def
183 /z y z add def
184 a 0 gt {
185 /b b a div def
186 }{
187 a 0 eq {
188 /b b y sub def
189 }{ a -3 eq {
190 /b b y add def } if
191 } ifelse
192 } ifelse
193 [ 0 b b z Div round Div dup 0 le { pop 1 } if ]
194 a 0 gt { 0 }{ y 2 div a -2 gt { neg }if } ifelse
195 setdash 1 setlinecap stroke
196 } def
197 %
198 /SymbolLine { % on stack [ x y x y ...
199 counttomark % number of elements
200 2 div cvi /n ED % n pairs
201 /YA ED /XA ED % the start point
202 n 1 sub {
203 /YB ED /XB ED
204 /XLength XB XA sub def
205 /YLength YB YA sub def
206 /PAngle YLength XLength Atan def
207 /XYLength XLength YLength Pyth def
208 %% for negative SymStep we calculate the distance
209 SymStep 0 lt
210 { %XYLength SymStep div abs cvi
211 /nSym SymStep abs cvi def }
212 { /nSym XYLength SymStep div cvi def }
213 ifelse
214 0.5 setflat
215 /Shift Symbol stringwidth pop 2 div def
216 /deltaX XLength nSym div def
217 /deltaY YLength nSym div def
218 curveticks
219 { XA YA moveto }
220 { XA Shift sub YA Shift sub moveto }
221 ifelse
222 nSym {
223 gsave
224 curveticks
225 { PAngle 180 sub CorrAngle sub tickAngle add /rotAngle ED
226 currentpoint translate rotAngle rotate
227 0 SymbolWidth 2 div moveto 0 SymbolWidth 2 div neg lineto
228 SymbolLinewidth setlinewidth stroke
229 }
230 {
231 rotateSymbol { PAngle 180 sub CorrAngle sub rotate } if
232 Symbol show
233 }
234 ifelse
235 grestore
236 deltaX deltaY rmoveto
237 } repeat
238 /YA YB def /XA XB def
239 } repeat
240 curveticks
241 { XA YA moveto }
242 { XA Shift sub YA Shift sub moveto }
243 ifelse
244 gsave
245 curveticks
246 { PAngle 180 sub CorrAngle sub tickAngle add /rotAngle ED
247 XA YA translate rotAngle rotate
248 0 SymbolWidth 2 div moveto 0 SymbolWidth 2 div neg lineto
249 SymbolLinewidth setlinewidth stroke
250 }
251 {
252 rotateSymbol { PAngle 180 sub CorrAngle sub rotate } if
253 Symbol show
254 }
255 ifelse
256 grestore
257 pop % delete the mark symbol
258 } def
259 %
260 /LineFill { % hv ------------ patch 7 -------------
261 gsave
262 abs /hatchWidthInc ED
263 abs /hatchSepInc ED
264 abs CLW add /a ED
265 a 0 dtransform round exch round exch
266 2 copy idtransform
267 exch Atan rotate
268 idtransform pop /a ED
269 .25 .25 itransform pathbbox
270 /y2 ED
271 a Div ceiling cvi /x2 ED /y1 ED
272 a Div cvi /x1 ED /y2 y2 y1 sub def
273 clipType % must be defined in pstricks.tex: clip -- eoclip
274 newpath
275 2 setlinecap
276 systemdict /setstrokeadjust known { true setstrokeadjust } if
277 x2 x1 sub 1 add {
278 x1 a mul y1 moveto 0 y2 rlineto stroke
279 /x1 x1 1 add
280 hatchWidthInc 0 gt { CLW add } if
281 def
282 hatchSepInc 0 gt hatchWidthInc 0 gt or {
283 /a a hatchSepInc add def
284 CLW hatchWidthInc add SLW
285 } if
286 } repeat
287 grestore
288 pop pop } def
289 %
290 /DotFill {% on stack: dot radius
291 /dotRadius ED
292 abs CLW add /a ED
293 a 0 dtransform round exch round exch
294 2 copy idtransform
295 exch Atan rotate
296 idtransform pop /a ED
297 .25 .25 itransform
298 pathbbox % llx lly urx ury of smallest bounding box
299 /y2 ED /x2 ED /y1 ED /x1 ED
300 y2 y1 sub a div 2 add cvi /Ny ED
301 x2 x1 sub a div 2 add cvi /Nx ED
302 clipType % must be defined in pstricks.tex: clip -- eoclip
303 newpath
304 /yA y1 dotRadius add CLW add def
305 /xA0 x1 dotRadius add CLW add def
306 Ny {
307 /xA xA0 def
308 Nx {
309 newpath
310 xA yA dotRadius 0 360 arc
311 SolidDot { gsave fill grestore } if
312 stroke
313 xA a add /xA ED
314 } repeat
315 yA a add /yA ED
316 } repeat
317 grestore
318 } def
319 %
320 /PenroseFill {% on stack: scaling factor
321 40 dict begin
322 /Scale ED
323 % 1 exch div round /penroseFactor ED
324 % a 0 dtransform round exch round exch
325 % 2 copy idtransform
326 % exch Atan rotate
327 % idtransform pop /a ED
328 % .25 .25 itransform pathbbox
329 % /y2 ED
330 % a Div ceiling cvi /x2 ED /y1 ED
331 % a Div cvi /x1 ED /y2 y2 y1 sub def
332 clip
333 newpath
334 gsave
335 220 150 translate
336 Scale dup scale
337 systemdict /setstrokeadjust known { true setstrokeadjust } if
338 /I/S/L/W/G/+/Z/F/E/D[/def/exch/for{E D}/add{s E get mul}
339 { Z -36.2001 1 33 }{25 E S rlineto}{/q Z dup q G E q 1 + G}{Z 2 2}]{cvx def}forall
340 [0 72 1008 {dup sin E cos }F ]1 setlinejoin/s W{/a W{/b I 10{/i I 4{/m I moveto
341 i m +/j I 10{/l Z b m l + G a l G sub s m get div .2 + floor .3 + 25
342 mul j l + S rmoveto}F i L j L stroke }F}F}F}F
343 grestore
344 % pop pop
345 end % userdict
346 } def
347 %
348 /PenroseFillA {% on stack: scaling factor, border color, kite color, dart color
349 50 dict begin
350 /Scale ED
351 Scale dup scale
352 /border_colour ED
353 /kite_colour ED
354 /dart_colour ED
355 clip
356 newpath
357 gsave
358 100 100 translate
359 6
360 Scale 1 lt { 1 Scale dup add div mul cvi } if %%%% Number of iterations
361 10 %%%% Long side length in millimeters
362 /border_width { L 0.06 mul }def %%%% Choose the scalefactor for the borders
363 /L exch 25.4 div 72 mul def %%%% Conversion: mm -> inches -> points
364 /f{-1 5 sqrt add 2 div}bind def %%%% The reciprocal of the golden ratio
365 /l{L f mul}bind def %%%% Short side length l = L*f
366 /Ll{L l add}bind def %%%% Ll = L + l
367 /c{36 cos L mul}bind def %%%% c = L*cos(36)
368 /s{36 sin L mul}bind def %%%% s = L*sin(36)
369 /draw_tile { 0 0 moveto c s lineto 0 lineto gsave closepath gsave fill grestore
370 0 setlinewidth stroke grestore border_colour stroke } bind def
371 /half_kite { dup dup 0 gt{ 1 sub gsave f f neg scale -36 rotate half_dart
372 Ll 0 translate 144 rotate kite grestore }
373 { kite_colour L draw_tile }ifelse
374 pop } bind def
375 /half_dart { dup dup 0 gt{ 1 sub gsave f f scale half_kite
376 -144 rotate Ll neg 0 translate half_dart grestore }
377 { dart_colour l draw_tile }ifelse
378 pop } bind def
379 /kite{ gsave half_kite 1 -1 scale half_kite grestore }bind def
380 border_width setlinewidth 1 setlinejoin 1 setlinecap
381 % 450 0 translate
382 dup f exch neg exp dup scale
383 5 {kite 72 rotate } repeat stroke
384 grestore
385 end % userdict
386 } def
387 %
388 %
389 /TruchetFill { % on stack: scaling factor
390 20 dict begin
391 dup dup scale
392 1 exch div round /penroseFactor ED
393 a 0 dtransform round exch round exch
394 2 copy idtransform
395 exch Atan rotate
396 idtransform pop /a ED
397 .25 .25 itransform pathbbox
398 /y2 ED
399 a Div ceiling cvi /x2 ED /y1 ED
400 a Div cvi /x1 ED /y2 y2 y1 sub def
401 clip
402 newpath
403 systemdict
404 /setstrokeadjust known { true setstrokeadjust } if
405 /ma a neg def
406 /ha a 2 div def
407 /mha ha neg def
408 /tile {
409 rand dup 2 idiv 2 mul eq { 90 rotate } if
410 mha mha moveto ha mha lineto
411 ha ha lineto mha ha lineto
412 % closepath .1 setlinewidth stroke
413 contents
414 } def
415 /contents{
416 0 ha moveto ha 0 lineto
417 0 mha moveto mha 0 lineto
418 % 1 setlinewidth stroke
419 } def
420 /dotiling {
421 f ma mul a f a mul {
422 /i exch def
423 f ma mul a f a mul {
424 /j exch def
425 gsave i j translate
426 tile stroke grestore
427 } for
428 } for
429 } def
430 %
431 /f 3 def
432 5 srand dotiling
433 end % local user dict
434 } def
435 %
436 /BeginArrow {
437 ADict begin % hold it local, for end see EndArrow
438 /@mtrx CM def
439 gsave
440 2 copy T
441 2 index sub neg exch
442 3 index sub exch Atan
443 rotate newpath
444 } def
445 %
446 /EndArrow { @mtrx setmatrix CP grestore end } def % end the ADict
447 %
448 /Arrow {
449 CLW mul add dup
450 2 div /w ED
451 mul dup /h ED
452 mul /a ED
453 { 0 h T 1 -1 scale } if
454 w neg h moveto
455 0 0 L w h L w neg a neg rlineto
456 gsave
457 % gsave w neg h lineto CLW 0.5 add setlinewidth % test für border beim Pfeil
458 % 1 setgray 0 setlinejoin closepath stroke
459 % grestore
460 fill grestore
461 } def
462 %
463 /ArrowD { % the sides are drawn as curves (hv 20071211)
464 CLW mul add dup
465 2 div /w ED
466 mul dup /h ED
467 mul /Inset ED
468 { 0 h T 1 -1 scale } if % changes the direction
469 % we use y=w/h^2 * x^2 as equation for the control points
470 % for the coordinates the arrow is seen from top to bottom
471 % the bottom (tip) is (0;0)
472 w neg h moveto % lower left of >
473 w 9 div 4 mul neg h 3 div 2 mul
474 w 9 div neg h 3 div
475 0 0 curveto % tip of >
476 w 9 div h 3 div
477 w 9 div 4 mul h 3 div 2 mul
478 w h curveto % upper left of >
479 w neg Inset neg rlineto % move to x=0 and inset
480 gsave fill grestore
481 } def
482 %
483 /ArrowT { % like tikz
484 CLW mul add dup
485 2 div /w ED
486 mul dup /h ED
487 mul /Inset ED
488 { 0 h T 1 -1 scale } if % changes the direction
489 w 2 mul /w exch def
490 w neg h moveto % lower left of >
491 w 9 div 4 mul neg h 3 div 2 mul
492 w 9 div neg h 3 div
493 0 0 curveto % tip of >
494 w 9 div h 3 div
495 w 9 div 4 mul h 3 div 2 mul
496 w h curveto % upper left of >
497 % w neg Inset neg rlineto % move to x=0 and inset
498 % CLW SLW
499 % 1 0 0 setrgbcolor
500 2 setlinejoin
501 stroke
502 0 0 moveto
503 } def
504 %
505 /Tbar {
506 CLW mul add /z ED
507 z -2 div CLW 2 div moveto
508 z 0 rlineto stroke
509 0 CLW moveto
510 } def
511 %
512 /Bracket {
513 CLW mul add dup CLW sub 2 div
514 /x ED mul CLW add /y ED /z CLW 2 div def
515 x neg y moveto
516 x neg CLW 2 div L x CLW 2 div L x y L stroke
517 0 CLW moveto
518 } def
519 %
520 /RoundBracket {
521 CLW mul add dup 2 div
522 /x ED mul /y ED /mtrx CM def
523 0 CLW 2 div T x y mul 0 ne { x y scale } if
524 1 1 moveto
525 .85 .5 .35 0 0 0 curveto
526 -.35 0 -.85 .5 -1 1 curveto
527 mtrx setmatrix stroke 0 CLW moveto
528 } def
529 %
530 /SD { 0 360 arc fill } def
531 %
532 /EndDot { % DS is the dot size
533 { /z DS def } { /z 0 def } ifelse % outer or inner dimen
534 /b ED % the color definition
535 0 z DS SD
536 b { 0 z DS CLW sub SD } if
537 0 DS z add CLW 4 div sub
538 moveto
539 } def
540 %
541 /Shadow { [ { /moveto load } { /lineto load } { /curveto load } {
542 /closepath load } /pathforall load stopped { pop pop pop pop CP /moveto
543 load } if ] cvx newpath 3 1 roll T exec } def
544 %
545 /NArray { % holds the coordinates and on top of stack the showpoints boolean
546 /showpoints ED
547 counttomark 2 div dup cvi /n ED % n 2 div on stack
548 n eq not { exch pop } if % even numbers of points? delete one
549 ] aload /Points ED
550 showpoints not { Points aload pop } if
551 % { ] aload /Points ED }
552 % { n 2 mul 1 add -1 roll pop } ifelse % delete the mark symbol
553 } def
554 %
555 /Line {
556 NArray n 0 eq not
557 { n 1 eq { 0 0 /n 2 def } if ArrowA /n n 2 sub def
558 n { Lineto } repeat
559 CP 4 2 roll ArrowB L pop pop
560 } if
561 } def
562 %
563 /LineToYAxis {
564 /Ox ED % Save the x origin value
565 NArray % all x-y pairs on stack
566 n { 2 copy moveto % go to current point
567 Ox exch Lineto % line to y-axis
568 pop % delete old x-value
569 } repeat
570 } def
571 %
572 /LineToXAxis{
573 /Oy ED % Save the y origin value
574 NArray % all x-y pairs on stack
575 n 0 eq not
576 { n 1 eq { 0 0 /n 2 def } if
577 ArrowA
578 /n n 2 sub def
579 CP 2 copy moveto pop Oy Lineto
580 n { 2 copy moveto pop Oy Lineto } repeat
581 CP
582 4 2 roll
583 ArrowB
584 2 copy moveto pop Oy
585 L
586 pop pop } if
587 } def
588 %
589 /Arcto {
590 /a [ 6 -2 roll ] cvx def
591 a r
592 /arcto load stopped { 5 } { 4 } ifelse { pop } repeat
593 a
594 } def
595 %
596 /CheckClosed {
597 dup n 2 mul 1 sub index eq 2 index n 2 mul 1 add index eq
598 and { pop pop /n n 1 sub def } if
599 } def
600 %
601 /Polygon {
602 NArray n 2 eq { 0 0 /n 3 def } if
603 n 3 lt
604 { n { pop pop } repeat }
605 { n 3 gt { CheckClosed } if
606 n 2 mul -2 roll
607 /y0 ED /x0 ED /y1 ED /x1 ED
608 x1 y1
609 /x1 x0 x1 add 2 div def
610 /y1 y0 y1 add 2 div def
611 x1 y1 moveto
612 /n n 2 sub def
613 n { Lineto } repeat
614 x1 y1 x0 y0 6 4 roll Lineto
615 Lineto pop pop closepath } ifelse
616 } def
617 %
618 /SymbolPolygon { % on stack [ x y x y ...
619 counttomark % number of elements
620 2 add /m ED
621 2 copy m 2 roll % copy last two
622 m 2 div cvi /n ED % n pairs
623 /YA ED /XA ED % the start point
624 n 1 sub {
625 /YB ED /XB ED
626 /XLength XB XA sub def
627 /YLength YB YA sub def
628 /PAngle YLength XLength Atan def
629 /XYLength XLength YLength Pyth def
630 /nSym XYLength SymStep Div cvi def
631 /Shift Symbol stringwidth pop 2 Div def
632 /deltaX XLength nSym Div def
633 /deltaY YLength nSym Div def
634 XA Shift sub YA Shift sub moveto
635 nSym {
636 gsave rotateSymbol { PAngle 180 sub CorrAngle sub rotate } if
637 Symbol show
638 grestore
639 deltaX deltaY rmoveto
640 } repeat
641 % XB Shift sub YB Shift sub moveto Symbol show
642 /YA YB def /XA XB def
643 } repeat
644 pop % delete the mark symbol
645 } def
646 %
647 /Diamond {
648 /mtrx CM def
649 T rotate
650 /h ED
651 /w ED
652 dup 0 eq { pop } { CLW mul neg
653 /d ED
654 /a w h Atan def
655 /h d a sin Div h add def
656 /w d a cos Div w add def } ifelse
657 mark w 2 div h 2 div w 0 0 h neg w neg 0 0 h w 2 div h 2 div
658 /ArrowA { moveto } def
659 /ArrowB { } def
660 false Line
661 closepath mtrx setmatrix } def
662 %
663 /Triangle {
664 /mtrx CM def
665 translate
666 rotate /h ED 2 div /w ED
667 dup CLW mul /d ED
668 /h h d w h Atan sin Div sub def
669 /w w d h w Atan 2 div dup cos exch sin Div mul sub def
670 mark
671 0 d w neg d 0 h w d 0 d
672 /ArrowA { moveto } def
673 /ArrowB { } def
674 false
675 Line
676 closepath
677 mtrx
678 % DG/SR modification begin - Jun. 1, 1998 - Patch 3 (from Michael Vulis)
679 % setmatrix } def
680 setmatrix pop
681 } def
682 % DG/SR modification end
683 %
684 /CCA {
685 /y ED /x ED
686 2 copy y sub /dy1 ED
687 x sub /dx1 ED
688 /l1 dx1 dy1 Pyth def
689 } def
690 %
691 /CC {
692 /l0 l1 def
693 /x1 x dx sub def
694 /y1 y dy sub def
695 /dx0 dx1 def
696 /dy0 dy1 def
697 CCA
698 /dx dx0 l1 c exp mul dx1 l0 c exp mul add def
699 /dy dy0 l1 c exp mul dy1 l0 c exp mul add def
700 /m dx0 dy0 Atan dx1 dy1 Atan sub 2 div cos abs b exp a mul dx dy Pyth Div 2 div def
701 /x2 x l0 dx mul m mul sub def
702 /y2 y l0 dy mul m mul sub def
703 /dx l1 dx mul m mul neg def
704 /dy l1 dy mul m mul neg def
705 } def
706 %
707 /IC {
708 /c c 1 add def
709 c 0 lt { /c 0 def } { c 3 gt { /c 3 def } if } ifelse
710 /a a 2 mul 3 div 45 cos b exp div def
711 CCA
712 /dx 0 def
713 /dy 0 def
714 } def
715 %
716 /BOC { IC CC x2 y2 x1 y1 ArrowA CP 4 2 roll x y curveto } def
717 /NC { CC x1 y1 x2 y2 x y curveto } def
718 /EOC { x dx sub y dy sub 4 2 roll ArrowB 2 copy curveto } def
719 /BAC { IC CC x y moveto CC x1 y1 CP ArrowA } def
720 /NAC { x2 y2 x y curveto CC x1 y1 } def
721 /EAC { x2 y2 x y ArrowB curveto pop pop } def
722 %
723 /OpenCurve {
724 % 5 dict begin
725 NArray n 3 lt
726 { n { pop pop } repeat }
727 { BOC /n n 3 sub def n { NC } repeat EOC } ifelse
728 % end
729 } def
730 %
731 /CurvePath {
732 %% for negative SymStep we calculate the distance
733 SymStep 0 lt { gsave PathLength SymStep div abs /SymStep ED grestore } if
734 0.5 setflat
735 flattenpath /z 0 def /z0 0 def
736 { /y1 ED /x1 ED /y2 y1 def /x2 x1 def
737 x1 Shift sub y1 Shift sub moveto
738 gsave
739 curveticks
740 { x1 y1 translate startAngle rotate
741 0 SymbolWidth 2 div moveto 0 SymbolWidth 2 div neg lineto
742 SymbolLinewidth setlinewidth stroke
743 }
744 { startAngle rotate Symbol show }
745 ifelse
746 grestore /z0 z def }
747 { /y ED /x ED PathLength@ z z0 sub SymStep ge {
748 x Shift sub y Shift sub moveto
749 gsave
750 curveticks
751 { y yOld sub x xOld sub Atan 180 sub CorrAngle sub /rotAngle ED
752 x y translate rotAngle rotate
753 0 SymbolWidth 2 div moveto 0 SymbolWidth 2 div neg lineto
754 SymbolLinewidth setlinewidth stroke
755 }
756 {
757 rotateSymbol { y yOld sub x xOld sub Atan 180 sub CorrAngle sub rotate } if
758 Symbol show
759 }
760 ifelse
761 grestore /z0 z def } if
762 /yOld y def /xOld x def }
763 {} %% the lineto part
764 { /y y2 def /x x2 def PathLength@
765 x Shift sub y Shift sub moveto
766 gsave
767 curveticks
768 { y yOld sub x xOld sub Atan 180 sub /rotAngle ED
769 x y translate rotAngle rotate
770 0 SymbolWidth 2 div moveto 0 SymbolWidth 2 div neg lineto
771 SymbolLinewidth setlinewidth stroke
772 }
773 {
774 x Shift sub y Shift sub moveto
775 rotateSymbol { y yOld sub x xOld sub Atan 180 sub CorrAngle sub rotate } if
776 Symbol show
777 }
778 ifelse
779 grestore
780 }
781 pathforall
782 % curveticks
783 % { gsave
784 % x y translate rotAngle rotate
785 % 0 SymbolWidth 2 div moveto 0 SymbolWidth 2 div neg lineto
786 % SymbolLinewidth setlinewidth stroke grestore
787 % } if
788 z
789 } def
790 %
791 /OpenSymbolCurve {
792 OpenCurve
793 0.1 setflat
794 /Shift Symbol stringwidth pop 2 div def
795 CurvePath
796 } def
797 %
798 /AltCurve {
799 { false NArray n 2 mul 2 roll
800 [ n 2 mul 3 sub 1 roll ] aload
801 /Points ED
802 n 2 mul -2 roll }
803 { false NArray } ifelse
804 n 4 lt { n { pop pop } repeat } { BAC /n n 4 sub def n { NAC } repeat EAC } ifelse
805 } def
806 %
807 /AltOpenSymbolCurve {
808 AltCurve
809 0.1 setflat
810 /Shift Symbol stringwidth pop 2 div def
811 CurvePath
812 } def
813 %
814 /ClosedCurve {
815 NArray n 3 lt
816 { n { pop pop } repeat }
817 { n 3 gt { CheckClosed } if
818 6 copy n 2 mul 6 add 6 roll
819 IC CC x y moveto n { NC } repeat
820 closepath pop pop
821 } ifelse
822 } def
823 %
824 /ClosedSymbolCurve {
825 ClosedCurve
826 0.1 setflat
827 /Shift Symbol stringwidth pop 2 div def
828 CurvePath
829 } def
830 %
831 /CalcBezierSpline {% Christoph Bersch
832 10 dict begin
833 /getX { Points exch 2 mul get } def
834 /getY { Points exch 2 mul 1 add get } def
835 /n Points length 1 sub 2 idiv def
836 /GetFirstControlPoints {
837 /x n array def
838 /tmp n array def
839 /b 2 def
840 x 0 rhs 0 get b div put
841 1 1 n 1 sub {
842 /i exch def
843 tmp i 1 b div dup 4 1 roll put
844 i n 1 sub lt { 4 }{ 3.5 } ifelse exch sub /b exch def
845 x i rhs i get x i 1 sub get sub b div put
846 } for
847 1 1 n 1 sub {
848 n exch sub
849 dup dup x exch 1 sub 2 copy 6 2 roll
850 get 3 1 roll tmp exch get
851 exch x exch get mul sub
852 put
853 } for
854 x
855 } def
856 %
857 n 1 eq {
858 0 getX 2 mul 1 getX add 3 div
859 0 getY 2 mul 1 getY add 3 div
860 exch dup 3 1 roll 2 mul 0 getX sub
861 exch dup 3 1 roll 2 mul 0 getY sub
862 [ 0 getX 0 getY 7 3 roll 1 getX 1 getY ] /outPoints exch def
863 } {
864 /outPoints 6 n mul 2 add array def
865 0 1 n {
866 dup dup 6 mul dup 1 add
867 outPoints exch 5 -1 roll getY put
868 outPoints exch 3 -1 roll getX put
869 } for
870 /rhs n array def
871 1 1 n 2 sub {
872 rhs exch dup dup getX 4 mul exch 1 add getX 2 mul add put
873 } for
874 rhs 0 0 getX 1 getX 2 mul add put
875 rhs n 1 sub dup getX 8 mul n getX add 2 div put
876 GetFirstControlPoints
877 1 1 n 2 sub {
878 rhs exch dup dup getY 4 mul exch 1 add getY 2 mul add put
879 } for
880 rhs 0 0 getY 1 getY 2 mul add put
881 rhs n 1 sub dup getY 8 mul n getY add 2 div put
882 GetFirstControlPoints
883 0 1 n 1 sub {
884 /i exch def
885 2 copy
886 i get outPoints 6 i mul 3 add 3 -1 roll put
887 i get outPoints 6 i mul 2 add 3 -1 roll put
888 2 copy
889 i n 1 sub lt {
890 i 1 add get i 1 add getY 2 mul exch sub outPoints 6 i mul 5 add 3 -1 roll put
891 i 1 add get i 1 add getX 2 mul exch sub outPoints 6 i mul 4 add 3 -1 roll put
892 }{
893 n 1 sub get n getY add 2 div outPoints 6 n 1 sub mul 5 add 3 -1 roll put
894 n 1 sub get n getX add 2 div outPoints 6 n 1 sub mul 4 add 3 -1 roll put
895 } ifelse
896 } for
897 pop pop
898 } ifelse
899 outPoints
900 end
901 } def
902 /Spline {
903 /showpoints ED
904 counttomark 2 div dup cvi /n ED
905 n eq not { exch pop } if
906 ] /Points ED
907 n 1 gt {
908 CalcBezierSpline
909 mark exch aload pop
910 ArrowA
911 n 2 sub {
912 6 2 roll 4 2 roll curveto
913 } repeat
914 6 2 roll 4 2 roll ArrowB curveto
915 } if
916 } def
917 /OpenSymbolSpline {
918 Spline
919 0.1 setflat
920 /Shift Symbol stringwidth pop 2 div def
921 CurvePath
922 } def
923 %
924 /SQ { /r ED r r moveto r r neg L r neg r neg L r neg r L fill } def
925 /ST { /y ED /x ED x y moveto x neg y L 0 x L fill } def
926 /SP { /r ED gsave 0 r moveto 4 { 72 rotate 0 r L } repeat fill grestore } def
927 %
928 /FontDot {
929 DS 2 mul dup
930 matrix scale matrix concatmatrix exch matrix
931 rotate matrix concatmatrix exch
932 findfont exch makefont setfont
933 } def
934 %
935 /Rect {
936 x1 y1 y2 add 2 div moveto
937 % x1 y2 lineto
938 % x2 y2 lineto
939 % x2 y1 lineto
940 % x1 y1 lineto
941 x1 y1 lineto % counter clockwise path
942 x2 y1 lineto
943 x2 y2 lineto
944 x1 y2 lineto
945 closepath
946 } def
947 %
948 /OvalFrame {
949 x1 x2 eq y1 y2 eq or
950 { pop pop x1 y1 moveto x2 y2 L }
951 { y1 y2 sub abs x1 x2 sub abs 2 copy gt
952 { exch pop } { pop } ifelse
953 2 div exch { dup 3 1 roll mul exch } if
954 2 copy lt { pop } { exch pop } ifelse
955 /b ED
956 x1 y1 y2 add 2 div moveto
957 x1 y2 x2 y2 b arcto
958 x2 y2 x2 y1 b arcto
959 x2 y1 x1 y1 b arcto
960 x1 y1 x1 y2 b arcto
961 16 { pop } repeat
962 closepath
963 } ifelse
964 } def
965 %
966 /Frame { % on stack \psk@dimen
967 CLW mul /a ED % save radius
968 3 -1 roll
969 2 copy gt { exch } if
970 a sub /y2 ED
971 a add /y1 ED
972 2 copy gt { exch } if
973 a sub /x2 ED
974 a add /x1 ED
975 1 index 0 eq { pop pop Rect } { OvalFrame } ifelse
976 } def
977 %
978 /BezierNArray {
979 /f ED
980 counttomark 2 div dup cvi /n ED
981 n eq not { exch pop } if
982 n 1 sub neg 3 mod 3 add 3 mod { 0 0 /n n 1 add def } repeat
983 f { ] aload /Points ED } { n 2 mul 1 add -1 roll pop } ifelse
984 } def
985 %
986 /OpenBezier {
987 BezierNArray
988 n 1 eq
989 { pop pop }
990 { ArrowA n 4 sub 3 idiv
991 { 6 2 roll 4 2 roll curveto } repeat
992 6 2 roll 4 2 roll ArrowB curveto } ifelse
993 } def
994 %
995 /OpenSymbolBezier {
996 OpenBezier
997 0.1 setflat
998 /Shift Symbol stringwidth pop 2 div def
999 CurvePath
1000 } def
1001 %
1002 /ClosedBezier {
1003 BezierNArray
1004 n 1 eq
1005 { pop pop }
1006 { moveto n 1 sub 3 idiv
1007 { 6 2 roll 4 2 roll curveto } repeat
1008 closepath } ifelse
1009 } def
1010 %
1011 /ClosedSymbolBezier {
1012 /f ED % save showpoints value
1013 2 copy /yEnd ED /xEnd ED
1014 counttomark -2 roll 2 copy /yStart ED /xStart ED
1015 counttomark 2 roll
1016 f
1017 ClosedBezier
1018 0.1 setflat
1019 /Shift Symbol stringwidth pop 2 div def
1020 CurvePath
1021 [ xEnd yEnd xStart yStart SymbolLine
1022 } def
1023 %
1024 /BezierShowPoints {
1025 gsave
1026 Points aload length 2 div cvi /n ED
1027 moveto
1028 n 1 sub { lineto } repeat
1029 CLW 2 div SLW [ 4 4 ] 0 setdash stroke
1030 grestore
1031 } def
1032 %
1033 /Parab {
1034 /y0 ED /x0 ED /y1 ED /x1 ED
1035 /dx x0 x1 sub 3 div def
1036 /dy y0 y1 sub 3 div def
1037 x0 dx sub y0 dy add x1 y1 ArrowA
1038 x0 dx add y0 dy add x0 2 mul x1 sub y1 ArrowB
1039 curveto
1040 /Points [ x1 y1 x0 y0 x0 2 mul x1 sub y1 ] def
1041 } def
1042 %
1043 /Parab1 { % 1 end | 0 SP
1044 /ySP ED /xSP ED /y1 ED /x1 ED
1045 /dx xSP x1 sub 3 div def
1046 /dy ySP y1 sub 3 div def
1047 newpath x1 y1 moveto xSP y1 lineto xSP ySP lineto
1048 x1 ySP lineto closepath clip
1049 currentpoint
1050 newpath moveto
1051 xSP dx sub ySP dy add x1 y1 ArrowA
1052 xSP dx add ySP dy add xSP 2 mul x1 sub y1 ArrowB
1053 curveto
1054 /Points [ x1 y1 xSP ySP xSP 2 mul x1 sub y1 ] def
1055 } def
1056 %
1057 /Grid {
1058 40 dict begin
1059 newpath
1060 /a 4 string def
1061 /b ED % psk@gridlabels in pt
1062 /c ED % { \pst@usecolor\psgridlabelcolor }
1063 /n ED % psk@griddots
1064 cvi dup 1 lt { pop 1 } if
1065 /s ED % \psk@subgriddiv
1066 s div dup 0 eq { pop 1 } if
1067 /dy ED s div dup 0 eq { pop 1 } if % \pst@number\psyunit abs
1068 /dx ED dy div round dy mul % \pst@number\psxunit abs
1069 /y0 ED dx div round dx mul
1070 /x0 ED dy div round cvi
1071 /y2 ED dx div round cvi
1072 /x2 ED dy div round cvi
1073 /y1 ED dx div round cvi
1074 /x1 ED
1075 /h y2 y1 sub 0 gt { 1 } { -1 } ifelse def
1076 /w x2 x1 sub 0 gt { 1 } { -1 } ifelse def
1077 b 0 gt {
1078 /z1 b 4 div CLW 2 div add def
1079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1080 % Helvetica findfont b scalefont setfont
1081 % is set in pstricks.tex
1082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1083 % /NimbusSanL-Regu findfont b scalefont setfont
1084 /b b .95 mul CLW 2 div add def } if
1085 systemdict /setstrokeadjust known
1086 { true setstrokeadjust /t { } def }
1087 { /t { transform 0.25 sub round 0.25 add exch 0.25 sub round 0.25 add
1088 exch itransform } bind def } ifelse
1089 gsave n 0 gt { 1 setlinecap [ 0 dy n div ] dy n div 2 div setdash } { 2 setlinecap } ifelse
1090 /i x1 def
1091 /f y1 dy mul n 0 gt { dy n div 2 div h mul sub } if def
1092 /g y2 dy mul n 0 gt { dy n div 2 div h mul add } if def
1093 x2 x1 sub w mul 1 add dup 1000 gt { pop 1000 } if
1094 dup % run loop two times: lines and labels
1095 { i dx mul dup xGridOffset add y0 moveto % draw the lines
1096 dup t f moveto
1097 g t L stroke
1098 /i i w add def
1099 } repeat
1100 /i x1 def
1101 GridDX div ceiling cvi
1102 { i dx mul GridDX mul dup xGridOffset add y0 moveto % plot the labels
1103 b 0 gt
1104 { gsave c i GridDX mul a cvs dup stringwidth pop /z2 ED
1105 w 0 gt {z1} {z1 z2 add neg} ifelse
1106 h 0 gt {b neg}{z1} ifelse exch GridDX div z2 2 div sub exch
1107 rmoveto show grestore } if
1108 /i i w add def
1109 } repeat
1110 grestore
1111 gsave
1112 n 0 gt
1113 { 1 setlinecap [ 0 dx n div ] dx n div 2 div setdash }
1114 { 2 setlinecap } ifelse
1115 /i y1 def
1116 /f x1 dx mul n 0 gt { dx n div 2 div w mul sub } if def
1117 /g x2 dx mul n 0 gt { dx n div 2 div w mul add } if def
1118 y2 y1 sub h mul 1 add dup 1000 gt { pop 1000 } if
1119 dup % run loop two times: lines and labels
1120 { newpath i dy mul dup yGridOffset add x0 exch moveto
1121 dup f exch t moveto
1122 g exch t L stroke
1123 /i i h add def
1124 } repeat
1125 /i y1 def
1126 GridDY div ceiling cvi
1127 { newpath i dy mul GridDY mul dup yGridOffset add x0 exch moveto
1128 b 0 gt { gsave c i GridDY mul a cvs dup stringwidth pop
1129 /z2 ED
1130 w 0 gt {z1 z2 add neg} {z1} ifelse
1131 h 0 gt {z1} {b neg} ifelse GridDY div b 2 div sub
1132 rmoveto show grestore } if
1133 /i i h add def
1134 } repeat
1135 grestore
1136 end
1137 } def
1138 %
1139 /ArcArrow {
1140 /d ED /b ED /a ED
1141 gsave
1142 newpath 0 -1000 moveto clip
1143 newpath
1144 0 1 0 0 b
1145 grestore
1146 c mul
1147 /e ED
1148 pop pop pop r a e d PtoC y add exch x add
1149 exch r a PtoC y add exch x add exch b pop pop pop pop a e d CLW 8 div c
1150 mul neg d
1151 } def
1152 %
1153 %
1154 /isbool { type (booleantype) cvn eq } def
1155 %
1156 /Ellipse {
1157 dup isbool { /MoveToStart ED }{ /MoveToStart false def }ifelse % false or true
1158 /rotAngle ED
1159 /mtrx CM def
1160 T
1161 rotAngle rotate
1162 scale
1163 MoveToStart { 0 0 moveto 1 0 rmoveto } if % move to the start position
1164 0 0 1 5 3 roll arc
1165 mtrx setmatrix
1166 } def
1167 %
1168 /ArcAdjust { %%%% Vincent Guirardel
1169 % given a target length (targetLength) and an initial angle (angle0) [in the stack],
1170 % let M(angle0)=(rx*cos(angle0),ry*sin(angle0))=(x0,y0).
1171 % This computes an angle t such that (x0,y0) is at distance
1172 % targetLength from the point M(t)=(rx*cos(t),ry*sin(t)).
1173 % NOTE: this an absolute angle, it does not have to be added or substracted to angle0
1174 % contrary to TvZ's code.
1175 % To achieve, this, one iterates the following process: start with some angle t,
1176 % compute the point M' at distance targetLength of (x0,y0) on the semi-line [(x0,y0) M(t)].
1177 % Now take t' (= new angle) so that (0,0) M(t') and M' are aligned.
1178 %
1179 % Another difference with TvZ's code is that we need d (=add/sub) to be defined.
1180 % the value of d = add/sub is used to know on which side we have to move.
1181 % It is only used in the initialisation of the angle before the iteration.
1182 %
1183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1184 % Input stack: 1: target length 2: initial angle
1185 % variables used : rx, ry, d (=add/sub)
1186 %
1187 /targetLength ED /angle0 ED
1188 /x0 rx angle0 cos mul def
1189 /y0 ry angle0 sin mul def
1190 % we are looking for an angle t such that (x0,y0) is at distance targetLength
1191 % from the point M(t)=(rx*cos(t),ry*sin(t)))
1192 %initialisation of angle (using 1st order approx = TvZ's code)
1193 targetLength 57.2958 mul
1194 angle0 sin rx mul dup mul
1195 angle0 cos ry mul dup mul
1196 add sqrt div
1197 % if initialisation angle is two large (more than 90 degrees) set it to 90 degrees
1198 % (if the ellipse is very curved at the point where we draw the arrow, %
1199 % the value can be much more than 360 degrees !)
1200 % this should avoid going on the wrong side (more than 180 degrees) or go near
1201 % a bad attractive point (at 180 degrees)
1202 dup 90 ge { pop 90 } if
1203 angle0 exch d % add or sub
1204 % maximum number of times to iterate the iterative procedure:
1205 % iterative procedure: takes an angle t on top of stack, computes a
1206 % better angle (and put it on top of stack)
1207 30 { dup
1208 % compute distance D between (x0,y0) and M(t)
1209 dup cos rx mul x0 sub dup mul exch sin ry mul y0 sub dup mul add sqrt
1210 % if D almost equals targetLength, we stop
1211 dup targetLength sub abs 1e-5 le { pop exit } if
1212 % stack now contains D t
1213 % compute the point M(t') at distance targetLength of (x0,y0) on the semi-line [(x0,y0) M(t)]:
1214 % M(t')= ( (x(t)-x0)*targetLength/d+x0 , (y(t)-y0)*targetLength/d+y0 )
1215 exch dup cos rx mul x0 sub exch sin ry mul y0 sub
1216 % stack contains: y(t)-y0, x(t)-x0, d
1217 2 index Div targetLength mul y0 add ry Div exch
1218 2 index Div targetLength mul x0 add rx Div
1219 % stack contains x(t')/rx , y(t')/ry , d
1220 % now compute t', and remove D from stack
1221 atan exch pop
1222 } repeat
1223 % we don't look at what happened... in particular, if targetLength is greater
1224 % than the diameter of the ellipse...
1225 % the final angle will be around /angle0 + 180. maybe we should treat this pathological case...
1226 % after iteration, stack contains an angle t such that M(t) is the tail of the arrow
1227 % to give back the result as a an angle relative to angle0 we could add the following line:
1228 % angle0 sub 0 exch d
1229 %
1230 % begin bug fix 2006-01-11
1231 % we want to adjust the new angle t' by a multiple of 360 so that | t'-angle0 | <= 180
1232 %(we don't want to make the ellipse turn more or less than it should)...
1233 dup angle0 sub dup abs 180 gt { 180 add 360 div floor 360 mul sub } { pop } ifelse
1234 % end bug fix
1235 } def
1236 %
1237 /EllipticArcArrow {
1238 /d ED % is add or sub
1239 /b ED % arrow procedure
1240 /a1 ED % angle
1241 gsave
1242 newpath
1243 0 -1000 moveto
1244 clip % Set clippath far from arrow.
1245 newpath
1246 0 1 0 0 b % Draw arrow to determine length.
1247 grestore
1248 % Length of arrow is on top of stack. Next 3 numbers are junk.
1249 %
1250 a1 exch ArcAdjust % Angular position of base of arrow.
1251 /a2 ED
1252 pop pop pop
1253 a2 cos rx mul xOrig add % hv 2007-08-29 x->xOrig
1254 a2 sin ry mul yOrig add % hv 2007-08-29 y->yOrig
1255 a1 cos rx mul xOrig add %
1256 a1 sin ry mul yOrig add %
1257 % Now arrow tip coor and base coor are on stack.
1258 b pop pop pop pop % Draw arrow, and discard coordinates.
1259 a2 CLW 8 div
1260 % change value of d (test it by looking if `` 1 1 d '' gives 2 or not )
1261 1 1 d 2 eq { /d { sub } def } { /d { add } def } ifelse
1262 ArcAdjust
1263 % resets original value of d
1264 1 1 d 2 eq { /d { sub } def } { /d { add } def } ifelse % Adjust angle to give overlap.
1265 } def
1266 %%------------------ tvz/DG/hv (2004-05-10) end -------------------%%
1267 %
1268 /Rot { CP CP translate 3 -1 roll neg rotate NET } def
1269 %
1270 /RotBegin {
1271 tx@Dict /TMatrix known not { /TMatrix { } def /RAngle { 0 } def } if
1272 /TMatrix [ TMatrix CM ] cvx def
1273 /RotAngle ED
1274 RotAngle Rot /RAngle [ RAngle dup RotAngle add ] cvx def
1275 } def
1276 %
1277 /RotEnd {
1278 /TMatrix [ TMatrix setmatrix ] cvx def
1279 /RAngle [ RAngle pop ] cvx def
1280 } def
1281 %
1282 /PutCoor { gsave CP T CM STV exch exec moveto setmatrix CP grestore } def
1283 /PutBegin { /TMatrix [ TMatrix CM ] cvx def CP 4 2 roll T moveto } def
1284 /PutEnd { CP /TMatrix [ TMatrix setmatrix ] cvx def moveto } def
1285 %
1286 /Uput {
1287 /a ED
1288 add 2 div /h ED 2
1289 div /w ED
1290 /s a sin def
1291 /c a cos def
1292 /b s abs c abs 2 copy gt dup
1293 /q ED
1294 { pop } { exch pop } ifelse def
1295 /w1 c b div w mul def
1296 /h1 s b div h mul def
1297 q { w1 abs w sub dup c mul abs }{ h1 abs h sub dup s mul abs } ifelse
1298 } def
1299 %
1300 /UUput {
1301 5 dict begin
1302 /z ED
1303 abs /y ED
1304 /x ED
1305 q { x s div c mul abs y gt }{ x c div s mul abs y gt } ifelse
1306 { x x mul y y mul sub z z mul add sqrt z add }
1307 { q { x s div } { x c div } ifelse abs
1308 } ifelse
1309 a PtoC
1310 h1 add exch
1311 w1 add exch
1312 end
1313 } def
1314 %
1315 end
1316 %-----------------------------------------------------------------------------%
1317 %
1318 % END pstricks.pro