1 % Postscript header file for version 1.53 of graphs.sty. Frank Drewes, 19.12.2000
2 % Small bug in psdirbowoncircle and psdirbowonrectangle removed on 8. Dec. 97
5 /psloadcolour % [ r g b ] colour array
6 { aload pop setrgbcolor } def
8 /psrectangle % width, height, interior color, linecolour, linewidth, linedash
17 {/width width lwidth sub def}
21 {/height height lwidth sub def}
25 width 2 div neg height 2 div neg moveto
40 %-----------------------------------------------------------------------------%
42 /pscircle % diameter, interior color, line colour, line width, line dash
50 {/diam diam lwidth sub def}
55 0 0 diam 2 div 0 360 arc
67 %-----------------------------------------------------------------------------%
69 /psline % end x, end y, line width, line colour, line dash
80 %-----------------------------------------------------------------------------%
82 /psloop % from (#1,#2) to (#3,#4), line colour, line width, line dash
96 varxb varyb varvb varwb varv varw curveto
100 %-----------------------------------------------------------------------------%
102 /psloopbyangle % angle #1, axis (#2,#3), line colour, line width, line dash
106 /len axisX dup mul axisY dup mul add sqrt def
107 /betaA axisY axisX atan alpha 2 div sub def
108 /betaB betaA alpha add def
109 len betaA cos mul len betaA sin mul
110 len betaB cos mul len betaB sin mul} def
112 %-----------------------------------------------------------------------------%
114 /pslooparrowonrectangle % (#1,#2), (#3,#4), width, height, line colour,
115 % line width, line dash, arrow length, arrow width
130 /varxb varx 2 mul def
131 /varyb vary 2 mul def
132 /varvb varv 2 mul def
133 /varwb varw 2 mul def
134 varxb varyb varvb varwb varv varw curveto
136 /varv varv neg def /varw varw neg def
138 varv abs varw abs gt { exch } if
139 div dup mul 1 add width height mul mul sqrt 2 div /dist exch def
143 div dup mul 1 add size dup mul mul sqrt 2 div
146 {/dist height 2 div def}
148 {/dist width 2 div def}
150 /fstdist varv varw height getlen def
151 /snddist varw varv width getlen def
153 {/dist fstdist def} {/dist snddist def} ifelse
156 varw varv atan rotate
157 /pos varv dup mul varw dup mul add sqrt dist sub def
160 pos len awid atype psdrawarrow
163 %-----------------------------------------------------------------------------%
165 /pslooparrowoncircle % (#1,#2), (#3,#4), diameter, line colour, line width,
166 % line dash, arrow length, arrow width
180 /varxb varx 2 mul def
181 /varyb vary 2 mul def
182 /varvb varv 2 mul def
183 /varwb varw 2 mul def
184 varxb varyb varvb varwb varv varw curveto
186 /varv varv neg def /varw varw neg def
187 varw varv atan rotate
188 /pos varv dup mul varw dup mul add sqrt diam 2 div sub def
191 pos len awid atype psdrawarrow
194 %-----------------------------------------------------------------------------%
196 /psdeletebox % width, height
200 width 2 div neg height 2 div neg moveto
208 %-----------------------------------------------------------------------------%
210 /psarrowonrectangle % x, y, width, height, arrow length, arrow width,
211 % line colour, line width, dash array
225 div dup mul 1 add size dup mul mul sqrt 2 div
228 {/dist height 2 div def}
230 {/dist width 2 div def}
232 /fstdist xpos ypos height getlen def
233 /snddist ypos xpos width getlen def
235 {/dist fstdist def} {/dist snddist def} ifelse
238 ypos xpos atan rotate
239 /pos xpos dup mul ypos dup mul add sqrt dist sub def
240 pos len awid atype psdrawarrow
245 %-----------------------------------------------------------------------------%
257 ypos xpos atan rotate
258 /pos xpos dup mul ypos dup mul add sqrt diam 2 div sub def
259 pos len awid atype psdrawarrow
264 %-----------------------------------------------------------------------------%
275 /mtrx matrix currentmatrix def
276 newpath currx curry moveto
280 { currx curry translate
281 dup curry sub /ypos exch def /curry exch def
282 dup currx sub /xpos exch def /currx exch def
283 /len xpos sqr ypos sqr add sqrt def
284 /displace displace len mul def
285 ypos xpos atan rotate
287 /rad displace db sqr displace div add 2 div def
288 /radb rad displace sub def
289 /anglea radb db atan def
290 /angleb 180 anglea sub def
292 { db radb neg rad angleb anglea arcn }
293 { db radb neg rad 360 anglea sub angleb neg arc }
305 fillyes {gsave fillcolour psloadcolour fill grestore} if
311 %-----------------------------------------------------------------------------%
324 newpath currx curry moveto
328 /len newx currx sub dup mul newy curry sub dup mul add sqrt def
329 /firstx len factora mul angle cos mul currx add def
330 /firsty len factora mul angle sin mul curry add def
336 len factorb mul angle cos mul neg currx add
337 len factorb mul angle sin mul neg curry add
346 fillyes {gsave fillcolour psloadcolour fill grestore} if
352 %-----------------------------------------------------------------------------%
361 /fetch {/arg exch def dup arg exch def counttomark 1 roll} def
365 firstangle sin scndangle sin add 2 div
366 firstangle cos scndangle cos add 2 div
375 currax currbx ne curray currby ne or
376 {currby currbx /currax fetch /curray fetch}
386 newpath currax curray moveto
391 curray lasty sub currax lastx sub atan
392 currby curray sub currbx currax sub atan
396 currby curray sub currbx currax sub atan
397 nexty currby sub nextx currbx sub atan
400 /len currax currbx sub dup mul curray currby sub dup mul add sqrt lenfactor mul def
401 fstangle cos len mul currax add
402 fstangle sin len mul curray add
403 currbx sndangle cos len mul sub
404 currby sndangle sin len mul sub
416 fillyes {gsave fillcolour psloadcolour fill grestore} if
422 %-----------------------------------------------------------------------------%
429 0 translate -1 1 scale
432 { len len wid 2 div mul lineto
433 0 len wid neg mul rlineto}
437 len len wid 2 div mul curveto
438 len len wid -2 div mul lineto
448 %-----------------------------------------------------------------------------%
457 2 div /targetradius exch def
465 currx curry translate
466 othery curry sub /othery exch def
467 otherx currx sub /otherx exch def
468 /angle otherx neg othery atan def
469 /distance otherx sqr othery sqr add sqrt def
470 /displace displace distance mul def
471 /radius displace distance 2 div sqr displace div add 2 div def
472 /centerx angle cos radius displace sub mul otherx 2 div add def
473 /centery angle sin radius displace sub mul othery 2 div add def
475 { /anglea othery centery sub otherx centerx sub atan def
476 /angleb centery neg centerx neg atan def
478 { /anglea anglea 360 sub def }
481 { /anglea centery othery sub centerx otherx sub atan def
482 /angleb centery centerx atan def
484 { /anglea anglea 360 add def }
489 anglea angleb targetradius pscomputeposoncircle
490 /tipy exch def /tipx exch def
491 anglea angleb targetradius arrowlen add pscomputeposoncircle
492 /taily exch def /tailx exch def
498 { centerx centery radius angleb taily centery sub tailx centerx sub atan arcn }
499 { centerx centery radius angleb centery taily sub centerx tailx sub atan arc }
503 tailx taily translate
504 /tipx tipx tailx sub def
505 /tipy tipy taily sub def
506 tipy tipx atan rotate
507 arrowlen arrowlen awid atype psdrawarrow
510 /pscomputeposoncircle
515 /currangle alpha beta add 2 div def
516 /xpos currangle cos radius mul centerx add def
517 /ypos currangle sin radius mul centery add def
518 otherx xpos sub sqr othery ypos sub sqr add sqrt
520 newdist otherr sub abs .001 le
524 {/alpha currangle def}
525 {/beta currangle def}
528 currangle cos radius mul centerx add
529 currangle sin radius mul centery add
533 %-----------------------------------------------------------------------------%
542 2 div /sizey exch def
543 2 div /sizex exch def
551 currx curry translate
552 othery curry sub /othery exch def
553 otherx currx sub /otherx exch def
554 /angle otherx neg othery atan def
555 /distance otherx sqr othery sqr add sqrt def
556 /displace displace distance mul def
557 /radius displace distance 2 div sqr displace div add 2 div def
558 /centerx angle cos radius displace sub mul otherx 2 div add def
559 /centery angle sin radius displace sub mul othery 2 div add def
561 { /anglea othery centery sub otherx centerx sub atan def
562 /angleb centery neg centerx neg atan def
564 { /anglea anglea 360 sub def }
567 { /anglea centery othery sub centerx otherx sub atan def
568 /angleb centery centerx atan def
570 { /anglea anglea 360 add def }
575 anglea angleb pscomputeposonrectangle /tipy exch def /tipx exch def
576 /targetradius otherx tipx sub sqr othery tipy sub sqr add sqrt def
577 anglea angleb targetradius arrowlen add pscomputeposoncircle
578 /taily exch def /tailx exch def
584 { centerx centery radius angleb taily centery sub tailx centerx sub atan arcn }
585 { centerx centery radius angleb centery taily sub centerx tailx sub atan arc }
589 tailx taily translate
590 /tipx tipx tailx sub def
591 /tipy tipy taily sub def
592 tipy tipx atan rotate
593 arrowlen arrowlen awid atype psdrawarrow
596 /pscomputeposonrectangle
601 /currangle alpha beta add 2 div def
602 /xpos currangle cos radius mul centerx add def
603 /ypos currangle sin radius mul centery add def
604 /xdiff xpos otherx sub abs sizex sub def
605 /ydiff ypos othery sub abs sizey sub def
606 xdiff abs .001 le ydiff abs .001 le and
607 xdiff abs .001 le ydiff 0 le and
608 xdiff 0 le ydiff abs .001 le and
612 /counter counter 1 add def
613 xdiff 0 le ydiff 0 le and
614 {/alpha currangle def}
615 {/beta currangle def}
618 currangle cos radius mul centerx add
619 currangle sin radius mul centery add