1%%BeginResource: procset LoutDiagPrependGraphic 2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3% % 4% PostScript @SysPrependGraphic file for @Diag Jeffrey H. Kingston % 5% Version 2.0 (includes CIRCUM label) September 1996 % 6% % 7% This file has been placed in the public domain by its author, % 8% Jeffrey H. Kingston % 9% % 10% To assist in avoiding name clashes, the names of all symbols % 11% defined here begin with "ldiag". However, this is not feasible % 12% with user-defined labels and some labels used by users. % 13% % 14% <point> is two numbers, a point. % 15% <length> is one number, a length % 16% <angle> is one number, an angle in degrees % 17% <dashlength> is one number, the preferred length of a dash % 18% % 19%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 21errordict begin 22 /handleerror 23 { 24 { /Times-Roman findfont 8 pt scalefont setfont 25 0 setgray 4 pt 4 pt moveto 26 $error /errorname get 27 dup ldiagdict exch known 28 { ldiagdict exch get } 29 { 100 string cvs } ifelse 30 show 31 ( Command: ) show 32 $error /command get 100 string cvs show 33 } stopped {} if 34 showpage stop 35 } def 36end 37 38% begin diagram: <maxlabels> ldiagbegin - 39% must be defined outside ldiagdict since it loads it 40/ldiagbegin 41{ xsize 0 0 ysize ldiagdict begin 42 5 -1 roll /ldiagmaxlabels exch def 43 (@Diag) ldiagpushtagdict 44 /OOY ldiagpointdef /OOX ldiagpointdef 0 0 /OOO ldiagpointdef 45} def 46 47% end diagram: - ldiagend - 48/ldiagend 49{ ldiagpoptagdict end 50} def 51 52% concat strings: <string> <string> ldiagconcat <string> 53% must be defined outside ldiagdict since used in ldiagpromotelabels 54/ldiagconcat 55{ 2 copy length exch length add string 56 dup 0 4 index putinterval 57 dup 3 index length 3 index putinterval 58 3 1 roll pop pop 59} def 60 61% mconcat strings: <string> <string> ldiagmconcat <string> 62% returns concatenation, separated by @ if first is non-empty 63% must be defined outside ldiagdict since used in ldiagpromotelabels 64/ldiagmconcat 65{ 66 2 copy length exch length add 1 add string 67 dup 0 4 index putinterval 68 dup 3 index length (@) putinterval 69 dup 3 index length 1 add 3 index putinterval 70 3 1 roll pop pop 71} def 72 73% show string in format start ... end: <string> ldiagsends <string> 74/ldiagsends 75{ 76 dup length 20 string cvs (: ) ldiagconcat exch 77 dup 0 20 getinterval ( ... ) ldiagconcat 78 3 -1 roll exch ldiagconcat 79 exch dup length 20 sub 20 getinterval ldiagconcat 80} def 81 82/ldiagdebugposy 432 def 83/ldiagdebugposx 72 def 84 85% - ldiagdebugnextline - 86/ldiagdebugnextline 87{ 88 ldiagdebugposy 72 lt 89 { /ldiagdebugposx ldiagdebugposx 144 add store 90 /ldiagdebugposy 432 store 91 } 92 { 93 /ldiagdebugposy ldiagdebugposy 12 sub store 94 } ifelse 95 ldiagdebugposx ldiagdebugposy moveto 96} def 97 98% - ldiagdebugbeginindent - 99/ldiagdebugbeginindent 100{ 101 /ldiagdebugposx ldiagdebugposx 12 add store 102} def 103 104% - ldiagdebugendindent - 105/ldiagdebugendindent 106{ 107 /ldiagdebugposx ldiagdebugposx 12 sub store 108} def 109 110% <string> <int> ldiagdebugprint - 111% must be defined outside ldiagdict since used in arbitrary places 112% print <string> plus count or <int> stack entries, whichever is the smaller 113/ldiagdebugprint 114{ 115 exch 116 gsave 117 initgraphics 118 ldiagdebugnextline 119 /Times-Roman findfont 10 scalefont setfont 120 0 setgray show 121 ldiagdebugbeginindent 122 count 1 sub 2 copy lt { pop } { exch pop } ifelse 1 sub 123 0 exch 1 exch 124 { 125 ldiagdebugnextline 126 index 127 dup type (dicttype) eq 128 { 129 (begin dict) show 130 ldiagdebugbeginindent 131 { 132 ldiagdebugnextline 133 pop 100 string cvs show 134 } forall 135 ldiagdebugendindent 136 ldiagdebugnextline 137 (end dict) show 138 } 139 { 140 dup type (arraytype) eq 141 { 142 (begin array) show 143 ldiagdebugbeginindent 144 { 145 ldiagdebugnextline 146 100 string cvs show 147 } forall 148 ldiagdebugendindent 149 ldiagdebugnextline 150 (end array) show 151 } 152 { 153 100 string cvs show 154 } ifelse 155 } ifelse 156 } for 157 ldiagdebugendindent 158 grestore 159} def 160 161/ldiagdict 200 dict def 162ldiagdict begin 163 164% error messages 165/dictfull (dictfull error: too many labels?) def 166/dictstackoverflow (dictstackoverflow error: labels nested too deeply?) def 167/execstackoverflow (execstackoverflow error: figure nested too deeply?) def 168/limitcheck (limitcheck error: figure nested too deeply or too large?) def 169/syntaxerror (syntaxerror error: syntax error in text of figure?) def 170/typecheck (typecheck error: syntax error in text of figure?) def 171/undefined (undefined error: unknown or misspelt label?) def 172/VMError (VMError error: run out of memory?) def 173 174% push pi onto stack: - ldiagpi <num> 175/ldiagpi 3.14159 def 176 177% push e onto stack: - ldiage <num> 178/ldiage 2.71828 def 179 180% arc directions 181/clockwise false def 182/anticlockwise true def 183 184% test equality between two angles: <angle> <angle> ldiagangleeq <bool> 185/ldiagangleeq { ldiagfixangle exch ldiagfixangle eq } def 186 187% test inequality between two angles: <angle> <angle> ldiaganglene <bool> 188/ldiaganglene { ldiagangleeq not } def 189 190% maximum of two numbers: <num> <num> ldiagmax <num> 191/ldiagmax { 2 copy gt { pop } { exch pop } ifelse } def 192 193% minimum of two numbers: <num> <num> ldiagmin <num> 194/ldiagmin { 2 copy lt { pop } { exch pop } ifelse } def 195 196% add two points: <point> <point> ldiagpadd <point> 197/ldiagpadd 198{ 199 % (Entering padd) 4 ldiagdebugprint 200 exch 3 1 roll add 3 1 roll add exch 201 % (Leaving padd) 2 ldiagdebugprint 202} def 203 204% subtract first point from second: <point> <point> ldiagpsub <point> 205/ldiagpsub { 3 2 roll sub 3 1 roll exch sub exch } def 206 207% max two points: <point> <point> ldiagpmax <point> 208/ldiagpmax { exch 3 1 roll ldiagmax 3 1 roll ldiagmax exch } def 209 210% min two points: <point> <point> ldiagpmin <point> 211/ldiagpmin { exch 3 1 roll ldiagmin 3 1 roll ldiagmin exch } def 212 213% scalar multiplication: <point> <num> ldiagpmul <point> 214/ldiagpmul { dup 3 1 roll mul 3 1 roll mul exch } def 215 216% point at angle and distance: <point> <length> <angle> ldiagatangle <point> 217/ldiagatangle { 2 copy cos mul 3 1 roll sin mul ldiagpadd } def 218 219% angle from one point to another: <point> <point> ldiagangleto <angle> 220/ldiagangleto { ldiagpsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def 221 222% distance between two points: <point> <point> ldiagdistance <length> 223/ldiagdistance { ldiagpsub dup mul exch dup mul add sqrt } def 224 225% stroke a noline line: <length> <dashlength> ldiagnoline - 226/ldiagnoline 227{ pop pop 228} def 229 230% stroke a solid line: <length> <dashlength> ldiagsolid - 231/ldiagsolid 232{ pop pop [] 0 setdash 1 setlinecap stroke 233} def 234 235% stroke a dashed line: <length> <dashlength> ldiagdashed - 236/ldiagdashed 237{ 2 copy div 2 le 1 index 0 le or 238 { exch pop 1 pt ldiagmax [ exch dup ] 0 setdash } 239 { dup [ exch 4 2 roll 2 copy div 240 1 sub 2 div ceiling dup 4 1 roll 241 1 add mul sub exch div ] 0 setdash 242 } ifelse 0 setlinecap stroke 243} def 244 245% stroke a cdashed line: <length> <dashlength> ldiagcdashed - 246/ldiagcdashed 247{ % (Entering ldiagcdashed) 2 ldiagdebugprint 248 2 copy le 1 index 0 le or 249 { exch pop 1 pt ldiagmax [ exch dup ] dup 0 get 2 div setdash } 250 { dup [ 4 2 roll exch 2 copy exch div 251 2 div ceiling div 1 index sub 252 ] exch 2 div setdash 253 } ifelse 0 setlinecap stroke 254 % (Leaving ldiagcdashed) 0 ldiagdebugprint 255} def 256 257% stroke a dotted line: <length> <dashlength> ldiagdotted - 258/ldiagdotted 259{ 2 copy le 1 index 0 le or 260 { exch pop 1 pt ldiagmax [ exch 0 exch ] 0 setdash } 261 { 1 index exch div ceiling div 262 [ 0 3 2 roll ] 0 setdash 263 } ifelse 1 setlinecap stroke 264} def 265 266% scale array elements by factor: <array> <factor> ldiagscalearray <array> 267/ldiagscalearray 268{ 269 [ exch 3 2 roll 270 { exch dup 3 1 roll mul exch } forall 271 pop ] 272} def 273 274% sum array elements: <array> ldiagsumarray <number> 275/ldiagsumarray 276{ 277 0 exch { add } forall 278} def 279 280% begin a more complex line: <length> <dashlength> ldiaglinebegin - 281/ldiaglinebegin 282{ 283 % (Entering ldiaglinebegin) 2 ldiagdebugprint 284 20 dict begin 285 /dashlen exch 1 pt ldiagmax def 286 /len exch def 287 /gap dashlen def 288 /halfgap dashlen 2 div def 289 /dash dashlen def 290 /halfdash dashlen 2 div def 291 /dot 0 def 292 % (Leaving ldiaglinebegin) 0 ldiagdebugprint 293} def 294 295% end a more complex line: <linecap> <cycle> <startpos> <stoppos> ldiaglineend - 296/ldiaglineend 297{ 298 % (Entering ldiaglineend) 3 ldiagdebugprint 299 /stoppos exch def 300 /startpos exch def 301 /cycle exch def 302 /linecap exch def 303 /stopposlen stoppos ldiagsumarray def 304 /startposlen startpos ldiagsumarray def 305 /cyclelen cycle ldiagsumarray def 306 /effectivelen len startposlen add stopposlen sub def 307 effectivelen 0 gt cyclelen 0 gt and 308 { 309 /repeats effectivelen cyclelen div ceiling def 310 /factor len repeats cyclelen mul startposlen sub stopposlen add div def 311 cycle factor ldiagscalearray startposlen factor mul setdash 312 linecap setlinecap stroke 313 } if 314 end 315 % (Leaving ldiaglineend) 0 ldiagdebugprint 316} def 317 318% stroke a dotdashed line: <length> <dashlength> ldiagdotdashed - 319/ldiagdotdashed 320{ 321 ldiaglinebegin 322 1 [dash gap dot gap] [] [dash] 323 ldiaglineend 324} def 325 326% stroke a dotcdashed line: <length> <dashlength> ldiagdotcdashed - 327/ldiagdotcdashed 328{ 329 ldiaglinebegin 330 1 [dash gap dot gap] [halfdash] [halfdash] 331 ldiaglineend 332} def 333 334% stroke a dotdotdashed line: <length> <dashlength> ldiagdotdotdashed - 335/ldiagdotdotdashed 336{ 337 ldiaglinebegin 338 1 [dash gap dot gap dot gap] [] [dash] 339 ldiaglineend 340} def 341 342% stroke a dotdotcdashed line: <length> <dashlength> ldiagdotdotcdashed - 343/ldiagdotdotcdashed 344{ 345 ldiaglinebegin 346 1 [dash gap dot gap dot gap] [halfdash] [halfdash] 347 ldiaglineend 348} def 349 350% stroke a dotdotdotdashed line: <length> <dashlength> ldiagdotdotdotdashed - 351/ldiagdotdotdotdashed 352{ 353 ldiaglinebegin 354 1 [dash gap dot gap dot gap dot gap] [] [dash] 355 ldiaglineend 356} def 357 358% stroke a dotdotdotcdashed line: <length> <dashlength> ldiagdotdotdotcdashed - 359/ldiagdotdotdotcdashed 360{ 361 ldiaglinebegin 362 1 [dash gap dot gap dot gap dot gap] [halfdash] [halfdash] 363 ldiaglineend 364} def 365 366% shape and labels of the @Box symbol 367% ldiagbox <shape> 368/ldiagbox 369{ 370 0 0 /SW ldiagpointdef 371 xsize 0 /SE ldiagpointdef 372 xsize ysize /NE ldiagpointdef 373 0 ysize /NW ldiagpointdef 374 375 xsize 0.25 mul ysize /NNW ldiagpointdef 376 xsize 0.75 mul ysize /NNE ldiagpointdef 377 xsize 0.25 mul 0 /SSW ldiagpointdef 378 xsize 0.75 mul 0 /SSE ldiagpointdef 379 380 SE 0.5 ldiagpmul /S ldiagpointdef 381 NW 0.5 ldiagpmul /W ldiagpointdef 382 W SE ldiagpadd /E ldiagpointdef 383 S NW ldiagpadd /N ldiagpointdef 384 385 NE 0.5 ldiagpmul /CTR ldiagpointdef 386 387 0 dg /SSW@ANGLE ldiagangledef 388 0 dg /S@ANGLE ldiagangledef 389 0 dg /SSE@ANGLE ldiagangledef 390 45 dg /SE@ANGLE ldiagangledef 391 90 dg /E@ANGLE ldiagangledef 392 135 dg /NE@ANGLE ldiagangledef 393 180 dg /NNE@ANGLE ldiagangledef 394 180 dg /N@ANGLE ldiagangledef 395 180 dg /NNW@ANGLE ldiagangledef 396 225 dg /NW@ANGLE ldiagangledef 397 270 dg /W@ANGLE ldiagangledef 398 315 dg /SW@ANGLE ldiagangledef 399 400 [ CTR NE ldiagpsub /ldiagboxcircum cvx ] ldiagcircumdef 401 SW SE NE NW SW 402} def 403 404% shape and labels of the @CurveBox symbol 405% <margin> ldiagcurvebox <shape> 406/ldiagcurvebox 407{ 408 409 % (Entering ldiagcurvebox) 1 ldiagdebugprint 410 ldiagdecodelength /cbmgn exch def 411 412 xsize 0.5 mul ysize 0.5 mul /CTR ldiagpointdef 413 xsize 0.5 mul 0 /S ldiagpointdef 414 xsize ysize 0.5 mul /E ldiagpointdef 415 xsize 0.5 mul ysize /N ldiagpointdef 416 0 ysize 0.5 mul /W ldiagpointdef 417 418 cbmgn 0.293 mul cbmgn 0.293 mul /SW ldiagpointdef 419 xsize cbmgn 0.293 mul sub cbmgn 0.293 mul /SE ldiagpointdef 420 xsize cbmgn 0.293 mul sub ysize cbmgn 0.293 mul sub /NE ldiagpointdef 421 cbmgn 0.293 mul ysize cbmgn 0.293 mul sub /NW ldiagpointdef 422 423 0 dg /S@ANGLE ldiagangledef 424 45 dg /SE@ANGLE ldiagangledef 425 90 dg /E@ANGLE ldiagangledef 426 135 dg /NE@ANGLE ldiagangledef 427 180 dg /N@ANGLE ldiagangledef 428 225 dg /NW@ANGLE ldiagangledef 429 270 dg /W@ANGLE ldiagangledef 430 315 dg /SW@ANGLE ldiagangledef 431 432 [ xsize ysize 0.5 ldiagpmul cbmgn /ldiagcurveboxcircum cvx ] ldiagcircumdef 433 434 cbmgn 0 435 xsize cbmgn sub 0 436 [ xsize cbmgn sub cbmgn ] 437 xsize cbmgn 438 xsize ysize cbmgn sub 439 [ xsize cbmgn sub ysize cbmgn sub ] 440 xsize cbmgn sub ysize 441 cbmgn ysize 442 [ cbmgn ysize cbmgn sub ] 443 0 ysize cbmgn sub 444 0 cbmgn 445 [ cbmgn cbmgn ] 446 cbmgn 0 447 448 % (Leaving ldiagcurvebox) 0 ldiagdebugprint 449} def 450 451% shadow of the @ShadowBox symbol 452% its shape and labels are done, somewhat inaccurately, with ldiagbox 453% <shadowmargin> ldiagshadow - 454/ldiagshadow 455{ 456 /lfshm exch def 457 458 lfshm 0 moveto 459 0 lfshm neg rlineto 460 xsize 0 rlineto 461 0 ysize rlineto 462 lfshm neg 0 rlineto 463 xsize 0 lineto 464 closepath fill 465 466} def 467 468% shape and labels of the @Square symbol 469/ldiagsquare 470{ 471 xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef 472 CTR xsize xsize ysize ysize ldiagpmax 0.5 ldiagpmul ldiagpadd /NE ldiagpointdef 473 CTR 0 0 CTR NE ldiagdistance 135 ldiagatangle ldiagpadd /NW ldiagpointdef 474 CTR 0 0 CTR NE ldiagdistance 225 ldiagatangle ldiagpadd /SW ldiagpointdef 475 CTR 0 0 CTR NE ldiagdistance 315 ldiagatangle ldiagpadd /SE ldiagpointdef 476 SW 0.5 ldiagpmul SE 0.5 ldiagpmul ldiagpadd /S ldiagpointdef 477 NW 0.5 ldiagpmul NE 0.5 ldiagpmul ldiagpadd /N ldiagpointdef 478 SW 0.5 ldiagpmul NW 0.5 ldiagpmul ldiagpadd /W ldiagpointdef 479 SE 0.5 ldiagpmul NE 0.5 ldiagpmul ldiagpadd /E ldiagpointdef 480 481 0 dg /S@ANGLE ldiagangledef 482 45 dg /SE@ANGLE ldiagangledef 483 90 dg /E@ANGLE ldiagangledef 484 135 dg /NE@ANGLE ldiagangledef 485 180 dg /N@ANGLE ldiagangledef 486 225 dg /NW@ANGLE ldiagangledef 487 270 dg /W@ANGLE ldiagangledef 488 315 dg /SW@ANGLE ldiagangledef 489 490 [ CTR NE ldiagpsub /ldiagboxcircum cvx ] ldiagcircumdef 491 SW SE NE NW SW 492} def 493 494% shape and labels of the @Diamond symbol 495/ldiagdiamond 496{ 497 xsize 0 0.5 ldiagpmul /S ldiagpointdef 498 0 ysize 0.5 ldiagpmul /W ldiagpointdef 499 S W ldiagpadd /CTR ldiagpointdef 500 CTR W ldiagpadd /N ldiagpointdef 501 CTR S ldiagpadd /E ldiagpointdef 502 E N ldiagpadd 0.5 ldiagpmul /NE ldiagpointdef 503 N W ldiagpadd 0.5 ldiagpmul /NW ldiagpointdef 504 S W ldiagpadd 0.5 ldiagpmul /SW ldiagpointdef 505 S E ldiagpadd 0.5 ldiagpmul /SE ldiagpointdef 506 507 0 dg /S@ANGLE ldiagangledef 508 90 dg /E@ANGLE ldiagangledef 509 180 dg /N@ANGLE ldiagangledef 510 270 dg /W@ANGLE ldiagangledef 511 S E ldiagangleto /SE@ANGLE ldiagangledef 512 E N ldiagangleto /NE@ANGLE ldiagangledef 513 N W ldiagangleto /NW@ANGLE ldiagangledef 514 W S ldiagangleto /SW@ANGLE ldiagangledef 515 516 [ xsize ysize 0.5 ldiagpmul /ldiagdiamondcircum cvx ] ldiagcircumdef 517 S E N W S 518} def 519 520% shape and labels of the @Ellipse symbol 521/ldiagellipse 522{ 523 xsize 0 0.5 ldiagpmul /S ldiagpointdef 524 0 ysize 0.5 ldiagpmul /W ldiagpointdef 525 S W ldiagpadd /CTR ldiagpointdef 526 CTR W ldiagpadd /N ldiagpointdef 527 CTR S ldiagpadd /E ldiagpointdef 528 CTR xsize 0 0.3536 ldiagpmul ldiagpadd 0 ysize 0.3536 ldiagpmul ldiagpadd /NE ldiagpointdef 529 0 ysize 0.3536 ldiagpmul CTR xsize 0 0.3536 ldiagpmul ldiagpadd ldiagpsub /SE ldiagpointdef 530 xsize 0 0.3536 ldiagpmul CTR ldiagpsub 0 ysize 0.3536 ldiagpmul ldiagpadd /NW ldiagpointdef 531 0 ysize 0.3536 ldiagpmul xsize 0 0.3536 ldiagpmul CTR ldiagpsub ldiagpsub /SW ldiagpointdef 532 [ xsize ysize 0.5 ldiagpmul /ldiagellipsecircum cvx ] ldiagcircumdef 533 534 0 dg /S@ANGLE ldiagangledef 535 90 dg /E@ANGLE ldiagangledef 536 180 dg /N@ANGLE ldiagangledef 537 270 dg /W@ANGLE ldiagangledef 538 539 S E ldiagangleto /SE@ANGLE ldiagangledef 540 E N ldiagangleto /NE@ANGLE ldiagangledef 541 N W ldiagangleto /NW@ANGLE ldiagangledef 542 W S ldiagangleto /SW@ANGLE ldiagangledef 543 544 S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S 545} def 546 547% shape and labels of the @Circle symbol 548/ldiagcircle 549{ 550 xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef 551 CTR xsize 0 ysize 0 ldiagpmax 0.5 ldiagpmul ldiagpadd /E ldiagpointdef 552 CTR 0 0 CTR E ldiagdistance 45 ldiagatangle ldiagpadd /NE ldiagpointdef 553 CTR 0 0 CTR E ldiagdistance 90 ldiagatangle ldiagpadd /N ldiagpointdef 554 CTR 0 0 CTR E ldiagdistance 135 ldiagatangle ldiagpadd /NW ldiagpointdef 555 CTR 0 0 CTR E ldiagdistance 180 ldiagatangle ldiagpadd /W ldiagpointdef 556 CTR 0 0 CTR E ldiagdistance 225 ldiagatangle ldiagpadd /SW ldiagpointdef 557 CTR 0 0 CTR E ldiagdistance 270 ldiagatangle ldiagpadd /S ldiagpointdef 558 CTR 0 0 CTR E ldiagdistance 315 ldiagatangle ldiagpadd /SE ldiagpointdef 559 [ S E ldiagpsub /ldiagellipsecircum cvx ] ldiagcircumdef 560 561 0 dg /S@ANGLE ldiagangledef 562 45 dg /SE@ANGLE ldiagangledef 563 90 dg /E@ANGLE ldiagangledef 564 135 dg /NE@ANGLE ldiagangledef 565 180 dg /N@ANGLE ldiagangledef 566 225 dg /NW@ANGLE ldiagangledef 567 270 dg /W@ANGLE ldiagangledef 568 315 dg /SW@ANGLE ldiagangledef 569 570 S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S 571} def 572 573% shape and labels of the @VLine and @VArrow symbols 574/ldiagvline 575{ 576 xmark ysize ldiagprevious /FROM ldiagpointdef 577 xmark 0 ldiagprevious /TO ldiagpointdef 578} def 579 580% points of a polygon around base with given no of sides, vert init angle: 581% <sides> <angle> ldiagpolygon <point> ... <point> 582/ldiagpolygon 583{ exch round cvi exch 584 xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef 585 90 sub CTR 2 copy ldiagmax 5 3 roll 586 [ 4 copy pop /ldiagpolycircum cvx ] ldiagcircumdef 587 exch dup 360 exch div exch 588 1 1 3 2 roll 589 { 4 string cvs (P) exch ldiagconcat 590 3 copy exch pop (@ANGLE) ldiagconcat cvn exch 90 add exch ldiagangledef 591 cvn 6 copy pop pop ldiagatangle 2 copy 10 2 roll 592 3 2 roll ldiagpointdef 593 dup 3 1 roll add exch 594 } for 595 pop ldiagatangle 596} def 597 598% shape and labels of the @Isosceles triangle symbol 599/ldiagisosceles 600{ 601 xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef 602 0 0 /SW ldiagpointdef 603 xsize 0 /SE ldiagpointdef 604 xsize 0.5 mul ysize /N ldiagpointdef 605 xsize 0.5 mul 0 /S ldiagpointdef 606 SE 0.5 ldiagpmul N 0.5 ldiagpmul ldiagpadd /NE ldiagpointdef 607 SW 0.5 ldiagpmul N 0.5 ldiagpmul ldiagpadd /NW ldiagpointdef 608 609 [ xsize ysize /ldiagisoscelescircum cvx ] ldiagcircumdef 610 611 0 dg /SW@ANGLE ldiagangledef 612 0 dg /SE@ANGLE ldiagangledef 613 180 dg /N@ANGLE ldiagangledef 614 0 dg /S@ANGLE ldiagangledef 615 SE N ldiagangleto /NE@ANGLE ldiagangledef 616 N SW ldiagangleto /NW@ANGLE ldiagangledef 617 618 SW SE N SW 619} def 620 621% next array element: <array> <index> ldiaggetnext <array> <index> <any> true 622% or <array> <index> false 623/ldiaggetnext 624{ 2 copy exch length ge 625 { false } 626 { 2 copy get exch 1 add exch true } ifelse 627} def 628 629% check whether thing is number: <any> ldiagisnumbertype <any> <bool> 630/ldiagisnumbertype 631{ dup type dup 632 /integertype eq exch /realtype eq or 633} def 634 635% check whether thing is an array: <any> ldiagisarraytype <any> <bool> 636/ldiagisarraytype { dup type /arraytype eq } def 637 638% check whether thing is an array: <any> ldiagisnametype <any> <bool> 639/ldiagisnametype { dup type /nametype eq } def 640 641% get next item: <array> <index> ldiaggetnextitem <array> <index> 0 642% or <array> <index> <array> 1 643% or <array> <index> <point> 2 644/ldiaggetnextitem 645{ ldiaggetnext 646 { ldiagisarraytype 647 { 1 648 } 649 { ldiagisnumbertype 650 { 3 1 roll 651 ldiaggetnext 652 { ldiagisnumbertype 653 { 4 3 roll exch 2 654 } 655 { pop 3 2 roll pop 0 656 } ifelse 657 } 658 { 3 2 roll pop 0 659 } ifelse 660 } 661 { pop 0 662 } ifelse 663 } ifelse 664 } 665 { 0 666 } ifelse 667} def 668 669% approximate equality: num1 num2 approxeq <boolean> 670/approxeq 671{ dup 0 eq 672 { pop 0 eq 673 } 674 { dup 3 1 roll sub exch div abs 0.001 lt 675 } ifelse 676} def 677 678% set arc path: bool x1 y1 x2 y2 x0 y0 ldiagsetarc <angle> <angle> <dist> 679% the path goes from x1 y1 to x2 y2 about centre x0 y0, 680% anticlockwise if bool is true else clockwise. 681% The orientations of backwards pointing and forwards pointing 682% arrowheads are returned in the two angles, and 683% the length of the arc is returned in <dist>. 684/ldiagsetarc 685{ 686 % (Entering ldiagsetarc) 7 ldiagdebugprint 687 20 dict begin 688 matrix currentmatrix 8 1 roll 689 2 copy translate 2 copy 8 2 roll 690 4 2 roll ldiagpsub 6 2 roll ldiagpsub 691 dup /y1 exch def dup mul /y1s exch def 692 dup /x1 exch def dup mul /x1s exch def 693 dup /y2 exch def dup mul /y2s exch def 694 dup /x2 exch def dup mul /x2s exch def 695 /dist1 0 0 x1 y1 ldiagdistance def 696 /dist2 0 0 x2 y2 ldiagdistance def 697 698 y1s y2s approxeq 699 { -1 700 } 701 { y1s x2s mul y2s x1s mul sub y1s y2s sub div 702 } ifelse 703 /da exch def 704 705 x1s x2s approxeq 706 { -1 707 } 708 { x1s y2s mul x2s y1s mul sub x1s x2s sub div 709 } ifelse 710 /db exch def 711 712 da 0 gt db 0 gt and 713 { 714 % ( case 1, ellipse) 0 ldiagdebugprint 715 /LMax da sqrt db sqrt ldiagmax def 716 /scalex da sqrt LMax div def 717 /scaley db sqrt LMax div def 718 scalex scaley scale 719 0 0 LMax 720 0 0 x1 scalex mul y1 scaley mul ldiagangleto 721 0 0 x2 scalex mul y2 scaley mul ldiagangleto 722 2 copy eq { 360 add } if 723 2 copy 8 2 roll 724 5 index { arc } { arcn } ifelse 725 2 index 1 index 726 { 90 sub } { 90 add } ifelse 727 dup sin scaley mul exch cos scalex mul atan 728 2 index 2 index 729 { 90 add } { 90 sub } ifelse 730 dup sin scaley mul exch cos scalex mul atan 731 5 2 roll % res1 res2 ang1 ang2 anticlockwise 732 { exch sub } { sub } ifelse 733 dup 0 le { 360 add } if ldiagpi mul LMax mul 180 div 734 } 735 { 736 dist1 dist2 approxeq 737 % x1 y1 dist1 ( x1 y1, d) 3 ldiagdebugprint pop pop pop 738 % x2 y2 dist2 ( x2 y2, d) 3 ldiagdebugprint pop pop pop 739 { 740 % ( case 2, circle) 0 ldiagdebugprint 741 0 0 742 dist1 743 0 0 x1 y1 ldiagangleto 744 0 0 x2 y2 ldiagangleto 745 2 copy eq { 360 add } if 746 2 copy 8 2 roll 747 5 index { arc } { arcn } ifelse 748 2 index 1 index 749 { 90 sub } { 90 add } ifelse 750 2 index 2 index 751 { 90 add } { 90 sub } ifelse 752 5 2 roll % res1 res2 ang1 ang2 clockwise 753 { exch sub } { sub } ifelse 754 dup 0 le { 360 add } if 755 ldiagpi mul dist1 mul 180 div 756 } 757 { 758 % ( case 3, line) 0 ldiagdebugprint 759 x2 y2 lineto pop 760 x2 y2 x1 y1 ldiagangleto 761 x1 y1 x2 y2 ldiagangleto 762 x1 y1 x2 y2 ldiagdistance 763 } ifelse 764 } ifelse 765 4 -1 roll setmatrix 766 end 767 % (Leaving ldiagsetarc) 3 ldiagdebugprint 768} def 769 770% ldiagsetcurve: set up a Bezier curve from x0 y0 to x3 y3 771% and return arrowhead angles and length of curve (actually 0) 772% x0 y0 x1 y1 x2 y2 x3 y3 ldiagsetcurve <angle> <angle> <length> 773/ldiagsetcurve 774{ 8 copy curveto pop pop 775 ldiagangleto 776 5 1 roll 777 4 2 roll ldiagangleto 778 exch 779 0 780} def 781 782% ldiagsetpath: convert a Diag path into a PostScript path 783% [ shape ] ldiagsetpath - 784/ldiagsetpath 785{ 786 10 dict begin 787 0 newpath 788 /prevseen false def 789 /curveseen false def 790 { ldiaggetnextitem 791 dup 0 eq { pop exit } 792 { 1 eq 793 { /curveseen true def 794 /curve exch def 795 curve length 0 eq { /curveseen false def } if 796 } 797 { /ycurr exch def 798 /xcurr exch def 799 prevseen 800 { curveseen 801 { curve length 4 eq 802 { xprev yprev 803 curve 0 get curve 1 get 804 curve 2 get curve 3 get 805 xcurr ycurr 806 ldiagsetcurve pop pop pop 807 } 808 { xprev yprev xcurr ycurr 809 curve length 1 ge { curve 0 get } { 0 } ifelse 810 curve length 2 ge { curve 1 get } { 0 } ifelse 811 curve length 3 ge { curve 2 get } { true } ifelse 812 7 1 roll 813 ldiagsetarc pop pop pop 814 } ifelse 815 } 816 { xcurr ycurr lineto 817 } ifelse 818 } 819 { xcurr ycurr moveto 820 } ifelse 821 /xprev xcurr def 822 /yprev ycurr def 823 /prevseen true def 824 /curveseen false def 825 } ifelse 826 } ifelse 827 } loop pop pop 828 end 829} def 830 831% ldiagpaintpath: paint a path of the given shape 832% /paint [ shape ] ldiagpaintpath - 833/ldiagpaintpath 834{ 835 ldiagsetpath cvx exec 836} def 837 838% stroke a path of the given shape in the given linestyle and dash length. 839% Return the origin and angle of the backward and forward arrow heads. 840% dashlength /linestyle [shape] ldiagdopath [<point> <angle>] [<point> <angle>] 841/ldiagdopath 842{ 843 10 dict begin 844 0 845 /prevseen false def 846 /curveseen false def 847 /backarrow [] def 848 /fwdarrow [] def 849 { 850 ldiaggetnextitem 851 dup 0 eq { pop exit } 852 { 853 1 eq 854 { /curveseen true def 855 /curve exch def 856 curve length 0 eq { /prevseen false def } if 857 } 858 { /ycurr exch def 859 /xcurr exch def 860 prevseen 861 { newpath xprev yprev moveto 862 curveseen 863 { curve length 4 eq 864 { xprev yprev 865 curve 0 get curve 1 get 866 curve 2 get curve 3 get 867 xcurr ycurr ldiagsetcurve 868 } 869 { xprev yprev xcurr ycurr 870 curve length 1 ge { curve 0 get } { 0 } ifelse 871 curve length 2 ge { curve 1 get } { 0 } ifelse 872 curve length 3 ge { curve 2 get } { true } ifelse 873 7 1 roll 874 ldiagsetarc 875 } ifelse 876 } 877 { xcurr ycurr lineto 878 xcurr ycurr xprev yprev ldiagangleto dup 180 sub 879 xprev yprev xcurr ycurr ldiagdistance 880 } ifelse 881 6 index 6 index cvx exec 882 [ xprev yprev 5 -1 roll ] 883 backarrow length 0 eq 884 { /backarrow exch def } 885 { pop } ifelse 886 [ xcurr ycurr 4 -1 roll ] /fwdarrow exch def 887 } if 888 /xprev xcurr def 889 /yprev ycurr def 890 /prevseen true def 891 /curveseen false def 892 } ifelse 893 } ifelse 894 } loop 895 pop pop pop pop 896 backarrow length 0 eq { [ 0 0 0 ] } { backarrow } ifelse 897 fwdarrow length 0 eq { [ 0 0 0 ] } { fwdarrow } ifelse 898 end 899} def 900 901 902% stroke a path of the given shape in the given linestyle and dash length. 903% dashlength [ /linestyle ] [shape] ldiagdosegpath - 904/ldiagdosegpath 905{ 906 12 dict begin 907 1 index /seg exch def 908 1 index length /seglength exch def 909 0 /segcount exch def 910 0 911 /prevseen false def 912 /curveseen false def 913 /backarrow [] def 914 /fwdarrow [] def 915 { 916 ldiaggetnextitem 917 dup 0 eq { pop exit } 918 { 919 1 eq 920 { /curveseen true def 921 /curve exch def 922 curve length 0 eq { /prevseen false def } if 923 } 924 { /ycurr exch def 925 /xcurr exch def 926 prevseen 927 { newpath xprev yprev moveto 928 curveseen 929 { curve length 4 eq 930 { xprev yprev 931 curve 0 get curve 1 get 932 curve 2 get curve 3 get 933 xcurr ycurr ldiagsetcurve 934 } 935 { xprev yprev xcurr ycurr 936 curve length 1 ge { curve 0 get } { 0 } ifelse 937 curve length 2 ge { curve 1 get } { 0 } ifelse 938 curve length 3 ge { curve 2 get } { true } ifelse 939 7 1 roll 940 ldiagsetarc 941 } ifelse 942 } 943 { xcurr ycurr lineto 944 xcurr ycurr xprev yprev ldiagangleto dup 180 sub 945 xprev yprev xcurr ycurr ldiagdistance 946 } ifelse 947 6 index seg segcount seglength mod get cvx exec 948 /segcount segcount 1 add def 949 [ xprev yprev 5 -1 roll ] 950 backarrow length 0 eq 951 { /backarrow exch def } 952 { pop } ifelse 953 [ xcurr ycurr 4 -1 roll ] /fwdarrow exch def 954 } if 955 /xprev xcurr def 956 /yprev ycurr def 957 /prevseen true def 958 /curveseen false def 959 } ifelse 960 } ifelse 961 } loop 962 pop pop pop pop 963 end 964} def 965 966% ldiagnodebegin: start of node parameters 967% ldiagnodebegin - 968/ldiagnodebegin 969{ % (Entering ldiagnodebegin) 0 ldiagdebugprint 970 ldiagmaxlabels dict begin 971} def 972 973% ldiagnodeend: end of node parameters (so do the node) 974% <outline> <dashlength> <style> <linewidth> <colour> <paint> ldiagnodeend - 975/ldiagnodeend 976{ 977 % (Entering ldiagnodeend) 0 ldiagdebugprint 978 end % matches begin in ldiagnodebegin 979 5 index gsave ldiagpaintpath grestore % <outline> <dl> <st> <lw> <cl> 980 4 index ldiagsetpath clip newpath % <outline> <dl> <st> <lw> <cl> 981 exec % <outline> <dl> <st> <lw> 982 2 mul setlinewidth % <outline> <dl> <st> 983 3 -1 roll % <dashlength> <st> <outline> 984 ldiagdosegpath % - 985 % (Leaving ldiagnodeend) 0 ldiagdebugprint 986} def 987 988% ldiaglinkbegin: start of link parameters 989% <direct> ldiaglinkbegin - 990/ldiaglinkbegin 991{ ldiagmaxlabels dict begin 992 1 eq /direct exch def 993} def 994 995% ldiaglinkend: end of link parameters (so do the link) 996% <outline> <dashlength> <style> <linewidth> ldiaglinkend - 997/ldiaglinkend 998{ 999 end % matches begin in ldiaglinkbegin 1000 setlinewidth 1001 3 -1 roll ldiagdosegpath 1002} def 1003 1004% ldiagdoarrow: draw an arrow head of given form 1005% dashlength /lstyle /pstyle hfrac height width [ <point> <angle> ] ldiagdoarrow - 1006/ldiagdoarrow 1007{ matrix currentmatrix 8 1 roll 1008 dup 0 get 1 index 1 get translate 1009 2 get rotate 1010 [ 2 index neg 2 index 0 0 1011 3 index 3 index neg 1012 1 index 10 index mul 0 1013 7 index 7 index ] 1014 4 1 roll pop pop pop 1015 dup 3 1 roll 1016 gsave ldiagpaintpath grestore ldiagdopath pop pop 1017 setmatrix 1018} def 1019 1020% arrow head styles (unused) 1021% /ldiagopen 0.0 def 1022% /ldiaghalfopen 0.5 def 1023% /ldiagclosed 1.0 def 1024 1025% stroke no arrows, forward, back, and both 1026/ldiagnoarrow { pop pop pop pop pop pop pop pop } def 1027/ldiagforward { 7 -1 roll ldiagdoarrow pop } def 1028/ldiagback { 8 -2 roll pop ldiagdoarrow } def 1029/ldiagboth { 8 -1 roll 7 copy ldiagdoarrow pop 7 -1 roll ldiagdoarrow } def 1030 1031% ldiagprevious: return previous point on path 1032/ldiagprevious 1033{ ldiagisnumbertype 1034 { 2 copy } 1035 { ldiagisarraytype 1036 { 2 index 2 index } 1037 { 0 0 } 1038 ifelse 1039 } ifelse 1040} def 1041 1042% Tag dictionary operators 1043% 1044% Diag's tag dictionaries are kept on the same stack as other dictionaries, 1045% since there is nowhere else to put them. However, they are managed like 1046% a separate stack using the following operators: 1047% 1048% <tag> ldiagpushtagdict - Push a new, empty tag dictionary 1049% ldiagtoptagdict dict Find the top tag dictionary 1050% ldiagpoptagdict - Pop and destroy the top tag dictionary 1051% ldiagpopuptagdict - Pop top tag dict and promote its entries 1052% <array> ldiagpopsometagdict - Like popuptagdict but only those promote 1053% those labels listed in <array> 1054% ldiagdebugtagdict - Debug print of dictionary stack 1055% 1056% They are distinguished from other dictionaries by containing /ldiagtagdict, 1057% whose value is the <tag> which is used by ldiagpopuptagdict, 1058% and they are hopefully never the target of any non-tag definition because 1059% they are never the top dictionary, since push places the new dict second. 1060 1061/ldiagpushtagdict 1062{ ldiagmaxlabels dict dup 1063 currentdict end exch begin begin 1064 exch /ldiagtagdict exch put 1065} def 1066 1067/ldiagtoptagdict 1068{ /ldiagtagdict where not 1069 { (Diag internal error: no tag dictionary) show stop 1070 } if 1071} def 1072 1073/ldiagpoptagdict 1074{ 1075 % (Entering poptagdict) 0 ldiagdebugprint 1076 % ldiagdebugtagdict 1077 mark 1078 { currentdict end 1079 dup /ldiagtagdict known 1080 { exit 1081 } if 1082 } loop 1083 pop 1084 counttomark 1085 { begin 1086 } repeat 1087 pop 1088 % (Leaving poptagdict) 0 ldiagdebugprint 1089 % ldiagdebugtagdict 1090} def 1091 1092% promote labels from top tag dictionary to second top tag dictionary 1093% each prefixed by <string>@ if <string> (value of /ldiagtagdict) is not empty 1094% - ldiagpopuptagdict - 1095/ldiagpopuptagdict 1096{ 1097 ldiagtagdict 1098 % (Entering ldiagpopuptagdict) 1 ldiagdebugprint 1099 % ldiagdebugtagdict 1100 ldiagtoptagdict ldiagpoptagdict ldiagtoptagdict exch 1101 { exch dup length string cvs 1102 3 index exch ldiagmconcat 1103 cvn exch 2 index 3 1 roll put 1104 } forall 1105 pop pop 1106 % (Leaving ldiagpopuptagdict) 0 ldiagdebugprint 1107 % ldiagdebugtagdict 1108} def 1109 1110% similar to ldiagpopuptagdict but only those inner labels that are 1111% present in <array> will be promoted 1112% <array> ldiagpopsometagdict - 1113/ldiagpopsometagdict 1114{ 1115 ldiagtagdict 1116 % (Entering ldiagpopsometagdict) 1 ldiagdebugprint 1117 % ldiagdebugtagdict 1118 ldiagtoptagdict 1119 ldiagpoptagdict 1120 ldiagtoptagdict 1121 4 -1 roll 1122 { dup 3 index exch 1123 get 1124 exch 4 index 1125 exch ldiagmconcat exch 1126 3 copy put 1127 pop pop 1128 } forall 1129 pop pop pop 1130 % (Leaving ldiagpopuptagdict) 0 ldiagdebugprint 1131 % ldiagdebugtagdict 1132} def 1133 1134% debug tag dictionary stack 1135/ldiagdebugtagdict 1136{ (Entering ldiagdebugtagdict) 0 ldiagdebugprint 1137 30 array dictstack 1138 { dup /ldiagtagdict known 1139 { dup /ldiagtagdict get 0 ldiagdebugprint 1140 { pop 100 string cvs ( ) exch ldiagconcat 1141 dup 0 ldiagdebugprint 1142 pop 1143 } 1144 forall 1145 } 1146 { pop (other) 0 ldiagdebugprint 1147 } ifelse 1148 } forall 1149 (Leaving ldiagdebugtagdict) 0 ldiagdebugprint 1150} def 1151 1152% label a point in top tag dictionary: <point> /name ldiagpointdef - 1153/ldiagpointdef 1154{ 1155 % (Entering ldiagpointdef) 3 ldiagdebugprint 1156 [ 4 2 roll transform /itransform cvx ] cvx 1157 ldiagtoptagdict 3 1 roll put 1158 % (Leaving ldiagpointdef) 0 ldiagdebugprint 1159} def 1160 1161% label an angle in top tag dictionary: <angle> /name ldiagangledef - 1162/ldiagangledef 1163{ 1164 % (Entering ldiagangledef) 2 ldiagdebugprint 1165 exch ldiagfixangle ldiagtoptagdict 3 1 roll put 1166 % (Leaving ldiagangledef) 0 ldiagdebugprint 1167} def 1168 1169% add CIRCUM operator with this body: <array> ldiagcircumdef - 1170/ldiagcircumdef 1171{ % (Entering ldiagcircumdef) 1 ldiagdebugprint 1172 /CIRCUM exch cvx 1173 ldiagtoptagdict 3 1 roll put 1174 % currentdict end 1175 % 3 1 roll 1176 % def 1177 % begin 1178 % (Leaving ldiagcircumdef) 0 ldiagdebugprint 1179} def 1180 1181% show points (except CIRCUM and ANGLE): - ldiagshowpoints - 1182/ldiagshowpoints 1183{ 1184 % (Entering ldiagshowpoints) 0 ldiagdebugprint 1185 ldiagtoptagdict 1186 { 1 index 100 string cvs 1187 (ldiagdebugpos) search 1188 { pop pop pop pop pop } 1189 { 1190 (CIRCUM) search % if CIRCUM in key 1191 { pop pop pop pop pop } 1192 { 1193 (ANGLE) search % if ANGLE in key 1194 { 1195 pop pop pop pop pop 1196 } 1197 { 1198 (ldiagtagdict) search 1199 { 1200 pop pop pop pop pop 1201 } 1202 { 1203 pop cvx exec 1204 newpath 2.0 pt 0 360 arc 0 setgray fill pop 1205 } ifelse 1206 } ifelse 1207 } ifelse 1208 } ifelse 1209 } forall 1210 % (Leaving ldiagshowpoints) 0 ldiagdebugprint 1211} def 1212 1213 1214/ldiagshowtags 1215{ 1216 % (Entering ldiagshowtags) 0 ldiagdebugprint 1217 ldiagtoptagdict 1218 { 1 index 100 string cvs 1219 % dup 0 ldiagdebugprint 1220 (ldiagdebugpos) search 1221 { pop pop pop pop pop } 1222 { 1223 (CIRCUM) search % if CIRCUM in key 1224 { pop pop pop pop pop } 1225 { 1226 (ANGLE) search % if ANGLE in key 1227 { 1228 pop pop pop pop pop 1229 } 1230 { 1231 (ldiagtagdict) search 1232 { 1233 pop pop pop pop pop 1234 } 1235 { 1236 pop cvx exec 2 copy 1237 gsave 1238 newpath 2.0 pt 0 360 arc 0 setgray fill 1239 /Times-Roman findfont 8 pt scalefont setfont 1240 translate 40 rotate 0.2 cm 0.1 cm moveto 100 string cvs show 1241 grestore 1242 } ifelse 1243 } ifelse 1244 } ifelse 1245 } ifelse 1246 } forall 1247 % (Leaving ldiagshowtags) 0 ldiagdebugprint 1248} def 1249 1250 1251% show angles: - ldiagshowangles - 1252/ldiagshowangles 1253{ 1254 % (Entering ldiagshowangles) 0 ldiagdebugprint 1255 ldiagtoptagdict 1256 { 1 index 100 string cvs 1257 % dup 0 ldiagdebugprint 1258 (ldiagdebugpos) search 1259 { pop pop pop pop pop } 1260 { 1261 (ldiagtagdict) search 1262 { 1263 pop pop pop pop pop 1264 } 1265 { 1266 (CIRCUM) search % if CIRCUM in key 1267 { pop pop pop pop pop } 1268 { 1269 (@ANGLE) search % if ANGLE in key, draw the angle at the point 1270 { 1271 % (showing ANGLE) 5 ldiagdebugprint 1272 gsave exch pop exch pop cvx 1273 % (about to execute) 1 ldiagdebugprint 1274 exec translate rotate 0.8 0.8 scale pop 1275 newpath 0 0 2.0 pt 0 360 arc 0 setgray fill 1276 newpath 4 pt 0 moveto 9 pt 0 lineto 1277 9 pt 1.5 pt lineto 11 pt 0 lineto 9 pt -1.5 pt lineto 1278 9 pt 0 lineto [] 0 setdash 4 pt setlinewidth 0 setlinejoin 1279 stroke grestore 1280 % (finished ANGLE) 5 ldiagdebugprint 1281 } 1282 { 1283 % else must be a point, we aren't showing those 1284 pop pop pop 1285 } ifelse 1286 } ifelse 1287 } ifelse 1288 } ifelse 1289 } forall 1290 % (Leaving ldiagshowangles) 0 ldiagdebugprint 1291} def 1292 1293% fix an angle to 0 <= res < 360: <angle> ldiagfixangle <angle> 1294/ldiagfixangle 1295{ 1296 % (Entering ldiagfixangle) 1 ldiagdebugprint 1297 { dup 0 ge { exit } if 1298 360 add 1299 } loop 1300 { dup 360 lt { exit } if 1301 360 sub 1302 } loop 1303 % (Leaving ldiagfixangle) 1 ldiagdebugprint 1304} def 1305 1306% find point on circumference of box: alpha a b ldiagboxcircum x y 1307/ldiagboxcircum 1308{ 1309 % (Entering ldiagboxcircum) 3 ldiagdebugprint 1310 4 dict begin 1311 /b exch def 1312 /a exch def 1313 ldiagfixangle /alpha exch def 1314 0 0 a b ldiagangleto /theta exch def 1315 1316 % if alpha <= theta, return (a, a*tan(alpha)) 1317 alpha theta le 1318 { a a alpha sin mul alpha cos div } 1319 { 1320 % else if alpha <= 180 - theta, return (b*cot(alpha), b) 1321 alpha 180 theta sub le 1322 { b alpha cos mul alpha sin div b } 1323 { 1324 % else if alpha <= 180 + theta, return (-a, -a*tan(alpha)) 1325 alpha 180 theta add le 1326 { a neg a neg alpha sin mul alpha cos div } 1327 { 1328 % else if alpha <= 360 - theta, return (-b*cot(alpha), -b) 1329 alpha 360 theta sub le 1330 { b neg alpha cos mul alpha sin div b neg } 1331 { 1332 % else 360 - theta <= alpha, return (a, a*tan(alpha)) 1333 a a alpha sin mul alpha cos div 1334 } ifelse 1335 } ifelse 1336 } ifelse 1337 } ifelse 1338 end 1339 % (Leaving ldiagboxcircum) 2 ldiagdebugprint 1340} def 1341 1342% find quadratic roots (assume a != 0): a b c ldiagqroots x1 x2 2 1343% or x2 1 1344% or 0 1345/ldiagqroots 1346{ 1347 4 dict begin 1348 /c exch def 1349 /b exch def 1350 /a exch def 1351 /disc b b mul 4 a c mul mul sub def 1352 disc 0 lt 1353 { 0 1354 } 1355 { disc 0 eq 1356 { b neg 2 a mul div 1357 1 1358 } 1359 { b neg disc sqrt add 2 a mul div 1360 b neg disc sqrt sub 2 a mul div 1361 2 1362 } 1363 ifelse 1364 } 1365 ifelse 1366 end 1367} def 1368 1369% work our which quadrant: <angle> ldiagquadrant <0-3> 1370/ldiagquadrant 1371{ dup 90 lt 1372 { pop 0 1373 } 1374 { dup 180 lt 1375 { pop 1 1376 } 1377 { 270 lt 1378 { 2 1379 } 1380 { 3 1381 } ifelse 1382 } ifelse 1383 } ifelse 1384} def 1385 1386% find curvebox circum, assuming upper right quadrant: alpha a b xmk ldiagcb x y 1387/ldiagcb 1388{ 1389 6 dict begin 1390 /xmk exch def 1391 /b exch def 1392 /a exch def 1393 /alpha exch def 1394 /theta1 0 0 a b xmk sub ldiagangleto def 1395 /theta2 0 0 a xmk sub b ldiagangleto def 1396 alpha theta1 le 1397 { % if alpha <= theta1, return (a, a*tan(alpha)) 1398 a a alpha sin mul alpha cos div 1399 } 1400 { alpha theta2 ge 1401 { % else if alpha > theta2, return (b*cot(alpha), b) 1402 b alpha cos mul alpha sin div b 1403 } 1404 { 1405 % else, return the intersection of line and circle 1406 a xmk sub b xmk sub xmk 0 0 alpha ldiagcircleintersect 1407 dup 0 eq 1408 { % should never happen, just return any reasonable point 1409 pop 1410 a b 0.5 ldiagpmul 1411 } 1412 { 1 eq 1413 { % should never happen, just return the point on top of stack 1414 } 1415 { % the usual case, two points on stack, return the larger 1416 ldiagpmax 1417 } ifelse 1418 } ifelse 1419 } ifelse 1420 } ifelse 1421 end 1422} def 1423 1424% find point on circumference of curvebox: alpha a b xmk ldiagcurveboxcircum x y 1425/ldiagcurveboxcircum 1426{ 1427 % (Entering ldiagcurveboxcircum) 4 ldiagdebugprint 1428 5 dict begin 1429 /xmk exch def 1430 /b exch def 1431 /a exch def 1432 ldiagfixangle /alpha exch def 1433 1434 % work out which quadrant we are in, and reflect accordingly 1435 /quad alpha ldiagquadrant def 1436 quad 0 eq 1437 { alpha a b xmk ldiagcb 1438 } 1439 { quad 1 eq 1440 { 180 alpha sub a b xmk ldiagcb exch neg exch 1441 } 1442 { quad 2 eq 1443 { alpha 180 sub a b xmk ldiagcb neg exch neg exch 1444 } 1445 { 360 alpha sub a b xmk ldiagcb neg 1446 } ifelse 1447 } ifelse 1448 } ifelse 1449 end 1450 % (Leaving ldiagcurveboxcircum) 2 ldiagdebugprint 1451} def 1452 1453% find point on circumference of diamond: alpha a b ldiagdiamondcircum x y 1454/ldiagdiamondcircum 1455{ 1456 % (Entering ldiagdiamondcircum) 3 ldiagdebugprint 1457 4 dict begin 1458 /b exch def 1459 /a exch def 1460 ldiagfixangle /alpha exch def 1461 b alpha cos abs mul a alpha sin abs mul add /denom exch def 1462 a b mul alpha cos mul denom div 1463 a b mul alpha sin mul denom div 1464 end 1465 % (Leaving ldiagdiamondcircum) 2 ldiagdebugprint 1466} def 1467 1468% find point on circumference of ellipse: alpha a b ldiagellipsecircum x y 1469/ldiagellipsecircum 1470{ 1471 % (Entering ldiagellipsecircum) 3 ldiagdebugprint 1472 4 dict begin 1473 /b exch def 1474 /a exch def 1475 ldiagfixangle /alpha exch def 1476 b alpha cos mul dup mul a alpha sin mul dup mul add sqrt /denom exch def 1477 a b mul alpha cos mul denom div 1478 a b mul alpha sin mul denom div 1479 end 1480 % (Leaving ldiagellipsecircum) 2 ldiagdebugprint 1481} def 1482 1483% find point on circumference of isosceles: alpha a b ldiagisoscelescircum x y 1484/ldiagisoscelescircum 1485{ 1486 % (Entering ldiagisoscelescircum) 3 ldiagdebugprint 1487 7 dict begin 1488 /b exch def 1489 /a exch def 1490 /alpha exch ldiagfixangle def 1491 /theta1 90 def 1492 /theta2 a b 0.5 ldiagpmul 0 0 ldiagangleto def 1493 /theta3 a b 0.5 ldiagpmul a 0 ldiagangleto def 1494 alpha theta1 ge alpha theta2 le and 1495 { 0 0 a 2 div b 1496 } 1497 { alpha theta2 ge alpha theta3 le and 1498 { 0 0 a 0 1499 } 1500 { a 0 a 2 div b 1501 } ifelse 1502 } ifelse 1503 a 2 div b 2 div 2 copy 1 ft alpha ldiagatangle ldiaglineintersect 1504 a 2 div b 2 div 4 2 roll ldiagpsub 1505 end 1506 % (Leaving ldiagisoscelescircum) 2 ldiagdebugprint 1507} def 1508 1509% find point of intersection of two lines each defined by two points 1510% x1 y1 x2 y2 x3 y3 x4 y4 ldiaglineintersect x y 1511/ldiaglineintersect 1512{ 1513 % (Entering ldiaglineintersect) 8 ldiagdebugprint 1514 13 dict begin 1515 /y4 exch def 1516 /x4 exch def 1517 /y3 exch def 1518 /x3 exch def 1519 /y2 exch def 1520 /x2 exch def 1521 /y1 exch def 1522 /x1 exch def 1523 x2 x1 sub /x21 exch def 1524 x4 x3 sub /x43 exch def 1525 y2 y1 sub /y21 exch def 1526 y4 y3 sub /y43 exch def 1527 y21 x43 mul y43 x21 mul sub /det exch def 1528 1529 % calculate x 1530 y21 x43 mul x1 mul 1531 y43 x21 mul x3 mul sub 1532 y3 y1 sub x21 mul x43 mul add 1533 det div 1534 1535 % calculate y 1536 x21 y43 mul y1 mul 1537 x43 y21 mul y3 mul sub 1538 x3 x1 sub y21 mul y43 mul add 1539 det neg div 1540 1541 end 1542 % (Leaving ldiaglineintersect) 2 ldiagdebugprint 1543} def 1544 1545% find point on circumference of polygon 1546% alpha radius num theta ldiagpolycircum x y 1547/ldiagpolycircum 1548{ 1549 % (Entering ldiagpolycircum) 4 ldiagdebugprint 1550 13 dict begin 1551 /theta exch def 1552 /num exch def 1553 /radius exch def 1554 /alpha exch def 1555 1556 % calculate delta, the angle from theta to alpha 1557 alpha theta sub ldiagfixangle 1558 1559 % calculate the angle which is the multiple of 360/num closest to delta 1560 360 num div div truncate 360 num div mul theta add /anglea exch def 1561 1562 % calculate the next multiple of 360/num after anglea 1563 anglea 360 num div add /angleb exch def 1564 1565 % intersect the line through these two points with the alpha line 1566 anglea cos anglea sin angleb cos angleb sin 1567 0 0 alpha cos 2 mul alpha sin 2 mul 1568 ldiaglineintersect radius ldiagpmul 1569 1570 end 1571 % (Leaving ldiagpolycircum) 2 ldiagdebugprint 1572} def 1573 1574% find point of intersection of a line and a circle 1575% x0 y0 r x1 y1 theta ldiagcircleintersect xa ya xb yb 2 1576% or xb yb 1 1577% or 0 1578/ldiagcircleintersect 1579{ 1580 % (Entering ldiagcircleintersect) 6 ldiagdebugprint 1581 15 dict begin 1582 /theta exch def 1583 /y1 exch def 1584 /x1 exch def 1585 /r exch def 1586 /y0 exch def 1587 /x0 exch def 1588 1589 % if sin(theta) = 0 then line is horizontal and y must be y1 1590 theta sin abs 0.00001 lt 1591 { 1592 /a 1 def 1593 /b -2 x0 mul def 1594 /c x0 dup mul y1 y0 sub dup mul add r dup mul sub def 1595 a b c ldiagqroots dup 1596 0 eq 1597 { pop 1598 0 1599 } 1600 { 1 eq 1601 { y1 1 1602 } 1603 { y1 exch y1 2 1604 } ifelse 1605 } ifelse 1606 } 1607 { 1608 /ct theta cos theta sin div def 1609 /a ct ct mul 1 add def 1610 /b ct x1 x0 sub mul y1 add y0 sub 2 mul def 1611 /c x1 x0 sub dup mul y1 y0 sub dup mul add r dup mul sub def 1612 a b c ldiagqroots dup 1613 0 eq 1614 { pop 1615 0 1616 } 1617 { 1 eq 1618 { y1 add /yb exch def 1619 yb y1 sub ct mul x1 add /xb exch def 1620 xb yb 1 1621 } 1622 { y1 add /ya exch def 1623 ya y1 sub ct mul x1 add /xa exch def 1624 y1 add /yb exch def 1625 yb y1 sub ct mul x1 add /xb exch def 1626 xa ya xb yb 2 1627 } ifelse 1628 } ifelse 1629 } ifelse 1630 end 1631 % (Leaving ldiagcircleintersect) 1 ldiagdebugprint 1632} def 1633 1634% find line which is the perpendicular bisector of two points, defined 1635% by two points 1636% x1 y1 x2 y2 ldiaglinebetween x3 y3 x4 y4 1637/ldiaglinebetween 1638{ % (Entering ldiaglinebetween) 4 ldiagdebugprint 1639 /y2 exch def /x2 exch def 1640 /y1 exch def /x1 exch def 1641 1642 % let x3, y3 be the point halfway between the two points 1643 x1 y1 x2 y2 ldiagpadd 0.5 ldiagpmul 1644 /y3 exch def /x3 exch def 1645 1646 % find a point perpendicular to x3, y3 1647 x3 y3 50 x1 y1 x2 y2 ldiagangleto 90 dg add ldiagatangle 1648 1649 % plus x3 y3 gives the two points 1650 x3 y3 1651 1652 % (Leaving ldiaglinebetween) 4 ldiagdebugprint 1653} def 1654 1655% find <proc>@<string>: <proc> <string> ldiagfindlabel <any> true 1656% <proc> <string> false 1657/ldiagfindlabel 1658{ 1659 % (Entering ldiagfindlabel) 2 ldiagdebugprint 1660 exch dup length 1 ne 1661 { exch false 1662 % (Leaving ldiagfindabel (length not 1)) 3 ldiagdebugprint 1663 } 1664 { dup 0 get type /nametype ne 1665 { exch false 1666 % (Leaving ldiagfindabel (not a name)) 3 ldiagdebugprint 1667 } 1668 { dup 0 get dup length string cvs (@) ldiagconcat 1669 2 index ldiagconcat dup where 1670 { exch get exch pop exch pop cvx exec true 1671 % (Leaving ldiagfindlabel with success) 100 ldiagdebugprint 1672 } 1673 { 1674 pop exch false 1675 % (Leaving ldiagfindabel (concat not sensible)) 3 ldiagdebugprint 1676 } ifelse 1677 } ifelse 1678 } ifelse 1679} bind def 1680 1681% execute <proc>@<string> or else default: <proc> <string> ldiagdolabel <various> 1682/ldiagdolabel 1683{ 1684 % (Entering ldiagdolabel) 2 ldiagdebugprint 1685 ldiagfindlabel not 1686 { 1687 dup (CIRCUM) eq 1688 { pop pop pop 0 0 1689 } 1690 { 1691 dup (ANGLE) eq 1692 { pop pop 0 1693 } 1694 { pop cvx exec 1695 } ifelse 1696 } ifelse 1697 } if 1698 % (Leaving ldiagdolabel) 2 ldiagdebugprint 1699} bind def 1700 1701% execute a proc depending on whether number is negative, zero, or positive 1702% procneg proczero procpos number ldiagsigncase <anything> 1703/ldiagsigncase 1704{ 1705 % (Entering ldiagsigncase) 4 ldiagdebugprint 1706 dup 0 lt 1707 { pop pop pop exec 1708 } 1709 { 0 gt 1710 { exch pop exch pop exec 1711 } 1712 { pop exch pop exec 1713 } ifelse 1714 } ifelse 1715 % (Leaving ldiagsigncase) 0 ldiagdebugprint 1716} bind def 1717 1718% execute proci if angle is in ith quadrant 1719% proc45 proc270 proc180 proc90 proc0 proc315 proc225 proc135 angle ldiagquadcase <anything> 1720/ldiagquadcase 1721{ 1722 % (Entering ldiagquadcase) 9 ldiagdebugprint 1723 round ldiagfixangle cvi dup 90 mod 0 eq 1724 { 90 idiv 4 add } { 90 idiv } ifelse 1725 8 exch roll pop pop pop pop pop pop pop exec 1726 % (Leaving ldiagquadcase) 0 ldiagdebugprint 1727} bind def 1728 1729% decode Lout length into PostScript length 1730% <string> ldiagdecodelength <number> 1731/ldiagdecodelength 1732{ 1733 % (Entering ldiagdecodelength) 1 ldiagdebugprint 1734 (f) search 1735 { exch pop exch pop cvr ft 1736 } 1737 { (c) search 1738 { exch pop exch pop cvr cm 1739 } 1740 { (p) search 1741 { exch pop exch pop cvr pt 1742 } 1743 { (m) search 1744 { exch pop exch pop cvr em 1745 } 1746 { (s) search 1747 { exch pop exch pop cvr sp 1748 } 1749 { (v) search 1750 { exch pop exch pop cvr vs 1751 } 1752 { (i) search 1753 { exch pop exch pop cvr in 1754 } 1755 { pop 0 1756 } ifelse 1757 } ifelse 1758 } ifelse 1759 } ifelse 1760 } ifelse 1761 } ifelse 1762 } ifelse 1763 % (Leaving ldiagdecodelength) 1 ldiagdebugprint 1764} def 1765 1766% implement aabout function 1767% logical form: <circum> <extra> <centre> aabout <point> 1768% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx aabout <point> 1769/ldiagaabout 1770{ 1771 /centre exch def 1772 /extra exch def 1773 /circum exch def 1774 1775 /ZXCTR [ centre ] cvx def 1776 /ZFCTR [ circum (CTR) ldiagdolabel ] cvx def 1777 /ZAREF ZFCTR ZXCTR ldiagangleto def 1778 /ZAMIN 0 dg def 1779 /ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN sub 1780 circum (CIRCUM) ldiagdolabel ldiagpadd 1781 0 0 extra ZAREF ZAMIN sub ldiagatangle 1782 ldiagpadd ] cvx def 1783 1784 /ZAMAX 90 dg def 1785 /ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX sub 1786 circum (CIRCUM) ldiagdolabel ldiagpadd 1787 0 0 extra ZAREF ZAMAX sub ldiagatangle 1788 ldiagpadd ] cvx def 1789 1790 1 1 20 1791 { /xval exch def 1792 /ZAMID ZAMIN ZAMAX add 0.5 mul def 1793 /ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID sub 1794 circum (CIRCUM) ldiagdolabel ldiagpadd 1795 0 0 extra ZAREF ZAMID sub ldiagatangle 1796 ldiagpadd ] cvx def 1797 ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt 1798 { 1799 /ZAMAX [ ZAMID ] cvx def 1800 /ZPMAX [ ZPMID ] cvx def 1801 } 1802 { 1803 /ZAMIN [ ZAMID ] cvx def 1804 /ZPMIN [ ZPMID ] cvx def 1805 } ifelse 1806 } for 1807 ZPMID 1808} def 1809 1810% implement cabout function 1811% logical form: <circum> <extra> <centre> cabout <point> 1812% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx cabout <point> 1813/ldiagcabout 1814{ 1815 /centre exch def 1816 /extra exch def 1817 /circum exch def 1818 1819 /ZXCTR [ centre ] cvx def 1820 /ZFCTR [ circum (CTR) ldiagdolabel ] cvx def 1821 /ZAREF ZFCTR ZXCTR ldiagangleto def 1822 /ZAMIN 0 dg def 1823 /ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN add 1824 circum (CIRCUM) ldiagdolabel ldiagpadd 1825 0 0 extra ZAREF ZAMIN add ldiagatangle 1826 ldiagpadd ] cvx def 1827 1828 /ZAMAX 90 dg def 1829 /ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX add 1830 circum (CIRCUM) ldiagdolabel ldiagpadd 1831 0 0 extra ZAREF ZAMAX add ldiagatangle 1832 ldiagpadd ] cvx def 1833 1834 1 1 20 1835 { /xval exch def 1836 /ZAMID ZAMIN ZAMAX add 0.5 mul def 1837 /ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID add 1838 circum (CIRCUM) ldiagdolabel ldiagpadd 1839 0 0 extra ZAREF ZAMID add ldiagatangle 1840 ldiagpadd ] cvx def 1841 ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt 1842 { 1843 /ZAMAX [ ZAMID ] cvx def 1844 /ZPMAX [ ZPMID ] cvx def 1845 } 1846 { 1847 /ZAMIN [ ZAMID ] cvx def 1848 /ZPMIN [ ZPMID ] cvx def 1849 } ifelse 1850 } for 1851 ZPMID 1852} def 1853 1854% fromarrowlength toarrowlength { from } { to } xindent zindent ldiaglinepath - 1855/ldiaglinepath 1856{ 1857 % (entering ldiaglinepath) 0 ldiagdebugprint 1858 /zindent exch def 1859 /xindent exch def 1860 cvlit /to exch def 1861 cvlit /from exch def 1862 /toarrowlength exch def 1863 /fromarrowlength exch def 1864 1865 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto 1866 /FROM@ANGLE ldiagangledef 1867 from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd 1868 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd 1869 /FROM ldiagpointdef 1870 1871 FROM@ANGLE /TO@ANGLE ldiagangledef 1872 to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd 1873 0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef 1874 1875 FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 1876 FROM@ANGLE /LMID@ANGLE ldiagangledef 1877 1878 /XINDENT xindent FROM LMID ldiagdistance ldiagmin def 1879 FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef 1880 FROM@ANGLE /LFROM@ANGLE ldiagangledef 1881 1882 /ZINDENT zindent TO LMID ldiagdistance ldiagmin def 1883 0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef 1884 FROM@ANGLE /LTO@ANGLE ldiagangledef 1885 1886 direct { FROM TO } { FROM LFROM LMID LTO TO } ifelse 1887 1888 % (leaving ldiaglinepath) 0 ldiagdebugprint 1889} def 1890 1891% fromarrowlength toarrowlength { from } { to } xindent zindent pathgap ldiagdoublelinepath - 1892/ldiagdoublelinepath 1893{ 1894 % (entering ldiagdoublelinepath) 0 ldiagdebugprint 1895 /pathgap exch def 1896 /zindent exch def 1897 /xindent exch def 1898 cvlit /to exch def 1899 cvlit /from exch def 1900 /toarrowlength exch def 1901 /fromarrowlength exch def 1902 1903 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto 1904 /FROM@ANGLE ldiagangledef 1905 from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd 1906 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd 1907 /FROM ldiagpointdef 1908 1909 FROM@ANGLE /TO@ANGLE ldiagangledef 1910 to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd 1911 0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef 1912 1913 FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 1914 FROM@ANGLE /LMID@ANGLE ldiagangledef 1915 1916 /XINDENT xindent FROM LMID ldiagdistance ldiagmin def 1917 FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef 1918 FROM@ANGLE /LFROM@ANGLE ldiagangledef 1919 1920 /ZINDENT zindent TO LMID ldiagdistance ldiagmin def 1921 0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef 1922 FROM@ANGLE /LTO@ANGLE ldiagangledef 1923 1924 direct { 1925 FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle 1926 TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle 1927 [] 1928 FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle 1929 TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle 1930 } 1931 { 1932 FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle 1933 LFROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle 1934 LMID pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle 1935 LTO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle 1936 TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle 1937 [] 1938 FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle 1939 LFROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle 1940 LMID pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle 1941 LTO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle 1942 TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle 1943 } ifelse 1944 1945 % (leaving ldiagdoublelinepath) 0 ldiagdebugprint 1946} def 1947 1948% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagacurvepath - 1949/ldiagacurvepath 1950{ 1951 % (entering ldiagacurvepath) 0 ldiagdebugprint 1952 /bias exch def 1953 /zindent exch def 1954 /xindent exch def 1955 cvlit /to exch def 1956 cvlit /from exch def 1957 /toarrowlength exch def 1958 /fromarrowlength exch def 1959 1960 %/B1 bias 0.02 ft ldiagmax def 1961 %/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def 1962 %/BIAS B1 B2 ldiagmin def 1963 /BIAS bias 0.02 ft ldiagmax def 1964 /XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul 1965 to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def 1966 /XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel 1967 ldiagangleto 90 dg sub ldiagatangle ldiagpadd ] cvx def 1968 /CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween 1969 to (CTR) ldiagdolabel XTOP ldiaglinebetween 1970 ldiaglineintersect ] cvx def 1971 1972 from fromarrowlength [ CTR ] cvx ldiagaabout /FROM ldiagpointdef 1973 from (CTR) ldiagdolabel FROM ldiagdistance 0 gt 1974 { from (CTR) ldiagdolabel FROM ldiagangleto 1975 } 1976 { CTR FROM ldiagangleto 90 dg add 1977 } ifelse /FROM@ANGLE ldiagangledef 1978 1979 to toarrowlength [ CTR ] cvx ldiagcabout /TO ldiagpointdef 1980 TO to (CTR) ldiagdolabel ldiagdistance 0 gt 1981 { TO to (CTR) ldiagdolabel ldiagangleto 1982 } 1983 { CTR TO ldiagangleto 90 dg add 1984 } ifelse /TO@ANGLE ldiagangledef 1985 1986 /RADIUS CTR FROM ldiagdistance def 1987 CTR 0 0 RADIUS CTR FROM ldiagangleto 360 dg CTR TO ldiagangleto 1988 add CTR FROM ldiagangleto sub cvi 360 mod 0.5 mul add 1989 ldiagatangle ldiagpadd /LMID ldiagpointdef 1990 CTR LMID ldiagangleto 90 dg add /LMID@ANGLE ldiagangledef 1991 1992 /XINDENT xindent FROM LMID ldiagdistance ldiagmin def 1993 CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle 1994 ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef 1995 CTR LFROM ldiagangleto 90 dg add /LFROM@ANGLE ldiagangledef 1996 1997 /ZINDENT zindent TO LMID ldiagdistance ldiagmin def 1998 CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add 1999 ldiagatangle ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef 2000 CTR LTO ldiagangleto 90 dg add /LTO@ANGLE ldiagangledef 2001 2002 direct 2003 { FROM [CTR] TO } 2004 { FROM [CTR] LFROM [CTR] LMID [CTR] LTO [CTR] TO } 2005 ifelse 2006 2007 % (leaving ldiagacurvepath) 0 ldiagdebugprint 2008} def 2009 2010% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagccurvepath - 2011/ldiagccurvepath 2012{ 2013 % (entering ldiagccurvepath) 0 ldiagdebugprint 2014 % count ( stack size is) 1 ldiagdebugprint pop 2015 /bias exch def 2016 /zindent exch def 2017 /xindent exch def 2018 cvlit /to exch def 2019 cvlit /from exch def 2020 /toarrowlength exch def 2021 /fromarrowlength exch def 2022 2023 %/B1 bias 0.02 ft ldiagmax def 2024 %/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def 2025 %/BIAS B1 B2 ldiagmin def 2026 /BIAS bias 0.02 ft ldiagmax def 2027 /XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul 2028 to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def 2029 /XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel 2030 ldiagangleto 90 dg add ldiagatangle ldiagpadd ] cvx def 2031 /CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween 2032 to (CTR) ldiagdolabel XTOP ldiaglinebetween ldiaglineintersect ] cvx def 2033 2034 from fromarrowlength [ CTR ] cvx ldiagcabout /FROM ldiagpointdef 2035 from (CTR) ldiagdolabel FROM ldiagdistance 0 gt 2036 { from (CTR) ldiagdolabel FROM ldiagangleto } 2037 { CTR FROM ldiagangleto 90 dg sub } 2038 ifelse /FROM@ANGLE ldiagangledef 2039 2040 to toarrowlength [ CTR ] cvx ldiagaabout /TO ldiagpointdef 2041 TO to (CTR) ldiagdolabel ldiagdistance 0 gt 2042 { TO to (CTR) ldiagdolabel ldiagangleto } 2043 { CTR TO ldiagangleto 90 dg sub } 2044 ifelse /TO@ANGLE ldiagangledef 2045 2046 /RADIUS [ CTR FROM ldiagdistance ] cvx def 2047 CTR 0 0 RADIUS CTR TO ldiagangleto 360 dg CTR FROM ldiagangleto add 2048 CTR TO ldiagangleto sub cvi 360 cvi mod 2 div add ldiagatangle 2049 ldiagpadd /LMID ldiagpointdef 2050 CTR LMID ldiagangleto 90 dg sub /LMID@ANGLE ldiagangledef 2051 2052 /XINDENT [ xindent FROM LMID ldiagdistance ldiagmin ] cvx def 2053 CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd 2054 ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef 2055 CTR LFROM ldiagangleto 90 dg sub /LFROM@ANGLE ldiagangledef 2056 2057 /ZINDENT [ zindent TO LMID ldiagdistance ldiagmin ] cvx def 2058 CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add ldiagatangle 2059 ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef 2060 CTR LTO ldiagangleto 90 dg sub /LTO@ANGLE ldiagangledef 2061 2062 direct 2063 { FROM [CTR clockwise] TO } 2064 { FROM [CTR clockwise] LFROM [CTR clockwise] 2065 LMID [CTR clockwise] LTO [CTR clockwise] TO } 2066 ifelse 2067 % (leaving ldiagccurvepath) 0 ldiagdebugprint 2068} def 2069 2070 2071% farr tarr { from } { to } xindent zindent [frompt] [topt] ldiagbezierpath - 2072/ldiagbezierpath 2073{ 2074 % (entering ldiagbezierpath) 0 ldiagdebugprint 2075 % count ( stack size is) 1 ldiagdebugprint pop 2076 cvx /topt exch def 2077 cvx /frompt exch def 2078 /zindent exch def 2079 /xindent exch def 2080 cvlit /to exch def 2081 cvlit /from exch def 2082 /toarrowlength exch def 2083 /fromarrowlength exch def 2084 2085 from (CTR) ldiagdolabel frompt ldiagangleto /FROM@ANGLE ldiagangledef 2086 from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel 2087 ldiagpadd 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd 2088 /FROM ldiagpointdef 2089 2090 topt to (CTR) ldiagdolabel ldiagangleto /TO@ANGLE ldiagangledef 2091 to (CTR) ldiagdolabel TO@ANGLE 180 dg add to (CIRCUM) ldiagdolabel 2092 ldiagpadd 0 0 toarrowlength TO@ANGLE 180 dg add ldiagatangle ldiagpadd 2093 /TO ldiagpointdef 2094 2095 FROM 0 0 xindent FROM@ANGLE ldiagatangle ldiagpadd 2096 /LFROM ldiagpointdef 2097 FROM@ANGLE /LFROM@ANGLE ldiagangledef 2098 2099 TO 0 0 zindent TO@ANGLE 180 dg add ldiagatangle ldiagpadd 2100 /LTO ldiagpointdef 2101 TO@ANGLE /LTO@ANGLE ldiagangledef 2102 2103 FROM TO ldiagpadd frompt ldiagpadd topt ldiagpadd 0.25 ldiagpmul 2104 /LMID ldiagpointdef 2105 2106 FROM [frompt topt] TO 2107 2108 % (leaving ldiagbezierpath) 0 ldiagdebugprint 2109 % count ( stack size is) 1 ldiagdebugprint pop 2110} def 2111 2112 2113% farr tarr { from } { to } xindent zindent ldiagvhlinepath - 2114/ldiagvhlinepath 2115{ 2116 % (entering ldiagvhlinepath) 0 ldiagdebugprint 2117 % count ( stack size is) 1 ldiagdebugprint pop 2118 /zindent exch def 2119 /xindent exch def 2120 cvlit /to exch def 2121 cvlit /from exch def 2122 /toarrowlength exch def 2123 /fromarrowlength exch def 2124 2125 /CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def 2126 /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def 2127 /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def 2128 2129 from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd 2130 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef 2131 FANG /FROM@ANGLE ldiagangledef 2132 2133 to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd 2134 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef 2135 TANG 180 dg add /TO@ANGLE ldiagangledef 2136 2137 /FDIST [ FROM CTR ldiagdistance ] cvx def 2138 /TDIST [ TO CTR ldiagdistance ] cvx def 2139 /XINDENT [ xindent FDIST ldiagmin ] cvx def 2140 /ZINDENT [ zindent TDIST ldiagmin ] cvx def 2141 FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef 2142 FROM@ANGLE /LFROM@ANGLE ldiagangledef 2143 TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef 2144 TO@ANGLE /LTO@ANGLE ldiagangledef 2145 2146 CTR /LMID ldiagpointdef 2147 0 0 1 ft FANG 180 dg add ldiagatangle 2148 0 0 1 ft TANG 180 dg add ldiagatangle 2149 ldiagangleto /LMID@ANGLE ldiagangledef 2150 2151 FROM LFROM LMID LTO TO 2152 2153 % (leaving ldiagvhlinepath) 0 ldiagdebugprint 2154 % count ( stack size is) 1 ldiagdebugprint pop 2155} def 2156 2157% farr tarr { from } { to } xindent zindent radius ldiagvhcurvepath - 2158/ldiagvhcurvepath 2159{ 2160 % (entering ldiagvhcurvepath) 0 ldiagdebugprint 2161 % count ( stack size is) 1 ldiagdebugprint pop 2162 /radius exch def 2163 /zindent exch def 2164 /xindent exch def 2165 cvlit /to exch def 2166 cvlit /from exch def 2167 /toarrowlength exch def 2168 /fromarrowlength exch def 2169 2170 /CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def 2171 /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def 2172 /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def 2173 2174 from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd 2175 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef 2176 FANG /FROM@ANGLE ldiagangledef 2177 2178 to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd 2179 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef 2180 TANG 180 dg add /TO@ANGLE ldiagangledef 2181 2182 /FDIST [ FROM CTR ldiagdistance ] cvx def 2183 /TDIST [ TO CTR ldiagdistance ] cvx def 2184 /RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def 2185 /XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def 2186 /ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def 2187 2188 FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef 2189 FROM@ANGLE /LFROM@ANGLE ldiagangledef 2190 TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef 2191 TO@ANGLE /LTO@ANGLE ldiagangledef 2192 2193 /FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def 2194 /TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def 2195 /XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd 2196 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def 2197 XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd 2198 /LMID ldiagpointdef 2199 FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef 2200 2201 FROM LFROM FCTR 2202 {[XCTR clockwise]} {} {} {} {} {[XCTR]} {[XCTR clockwise]} {[XCTR]} 2203 FCTR TCTR ldiagangleto ldiagquadcase 2204 TCTR LTO TO 2205 2206 % (leaving ldiagvhcurvepath) 0 ldiagdebugprint 2207 % count ( stack size is) 1 ldiagdebugprint pop 2208} def 2209 2210% farr tarr { from } { to } xindent zindent ldiaghvlinepath - 2211/ldiaghvlinepath 2212{ 2213 % (entering ldiaghvlinepath) 0 ldiagdebugprint 2214 % count ( stack size is) 1 ldiagdebugprint pop 2215 /zindent exch def 2216 /xindent exch def 2217 cvlit /to exch def 2218 cvlit /from exch def 2219 /toarrowlength exch def 2220 /fromarrowlength exch def 2221 2222 /CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def 2223 /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def 2224 /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def 2225 2226 from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd 2227 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef 2228 FANG /FROM@ANGLE ldiagangledef 2229 2230 to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd 2231 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef 2232 TANG 180 dg add /TO@ANGLE ldiagangledef 2233 2234 /FDIST [ FROM CTR ldiagdistance ] cvx def 2235 /TDIST [ TO CTR ldiagdistance ] cvx def 2236 /XINDENT [ xindent FDIST ldiagmin ] cvx def 2237 /ZINDENT [ zindent TDIST ldiagmin ] cvx def 2238 2239 FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef 2240 FROM@ANGLE /LFROM@ANGLE ldiagangledef 2241 TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef 2242 TO@ANGLE /LTO@ANGLE ldiagangledef 2243 2244 CTR /LMID ldiagpointdef 2245 0 0 1 ft FANG 180 dg add ldiagatangle 2246 0 0 1 ft TANG 180 dg add ldiagatangle ldiagangleto 2247 /LMID@ANGLE ldiagangledef 2248 2249 FROM LFROM LMID LTO TO 2250 2251 % (leaving ldiaghvlinepath) 0 ldiagdebugprint 2252 % count ( stack size is) 1 ldiagdebugprint pop 2253} def 2254 2255% farr tarr { from } { to } xindent zindent radius ldiaghvcurvepath - 2256/ldiaghvcurvepath 2257{ 2258 % (entering ldiaghvcurvepath) 0 ldiagdebugprint 2259 % count ( stack size is) 1 ldiagdebugprint pop 2260 /radius exch def 2261 /zindent exch def 2262 /xindent exch def 2263 cvlit /to exch def 2264 cvlit /from exch def 2265 /toarrowlength exch def 2266 /fromarrowlength exch def 2267 2268 /CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def 2269 /FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def 2270 /TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def 2271 2272 from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd 2273 0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef 2274 FANG /FROM@ANGLE ldiagangledef 2275 2276 to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd 2277 0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef 2278 TANG 180 dg add /TO@ANGLE ldiagangledef 2279 2280 /FDIST [ FROM CTR ldiagdistance ] cvx def 2281 /TDIST [ TO CTR ldiagdistance ] cvx def 2282 /RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def 2283 /XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def 2284 /ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def 2285 FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef 2286 FROM@ANGLE /LFROM@ANGLE ldiagangledef 2287 TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef 2288 TO@ANGLE /LTO@ANGLE ldiagangledef 2289 2290 /FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def 2291 /TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def 2292 /XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd 2293 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def 2294 XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd 2295 /LMID ldiagpointdef 2296 FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef 2297 2298 FROM LFROM FCTR 2299 {[XCTR]} {} {} {} {} {[XCTR clockwise]} {[XCTR]} {[XCTR clockwise]} 2300 FCTR TCTR ldiagangleto ldiagquadcase 2301 TCTR LTO TO 2302 2303 % (leaving ldiaghvcurvepath) 0 ldiagdebugprint 2304 % count ( stack size is) 1 ldiagdebugprint pop 2305} def 2306 2307% farr tarr { from } { to } xindent zindent bias ldiaglvrlinepath - 2308/ldiaglvrlinepath 2309{ 2310 % (entering ldiaglvrlinepath) 0 ldiagdebugprint 2311 % count ( stack size is) 1 ldiagdebugprint pop 2312 /bias exch def 2313 /zindent exch def 2314 /xindent exch def 2315 cvlit /to exch def 2316 cvlit /from exch def 2317 /toarrowlength exch def 2318 /fromarrowlength exch def 2319 2320 from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd 2321 0 0 fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef 2322 180 dg /FROM@ANGLE ldiagangledef 2323 2324 to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd 2325 0 0 toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef 2326 0 dg /TO@ANGLE ldiagangledef 2327 2328 /XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def 2329 XLEFT FROM exch pop /P1 ldiagpointdef 2330 XLEFT TO exch pop /P2 ldiagpointdef 2331 /VERT [ P1 P2 ldiagangleto ] cvx def 2332 P1 P1 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle 2333 ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef 2334 P2 P2 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle 2335 ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef 2336 2337 P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2338 VERT /LMID@ANGLE ldiagangledef 2339 2340 /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def 2341 /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def 2342 XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef 2343 180 dg /LFROM@ANGLE ldiagangledef 2344 ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef 2345 0 dg /LTO@ANGLE ldiagangledef 2346 2347 FROM LFROM P1 LMID P2 LTO TO 2348 2349 % (leaving ldiaglvrlinepath) 0 ldiagdebugprint 2350 % count ( stack size is) 1 ldiagdebugprint pop 2351} def 2352 2353% farr tarr { from } { to } xindent zindent bias radius ldiaglvrcurvepath - 2354/ldiaglvrcurvepath 2355{ 2356 % (entering ldiaglvrcurvepath) 0 ldiagdebugprint 2357 % count ( stack size is) 1 ldiagdebugprint pop 2358 /radius exch def 2359 /bias exch def 2360 /zindent exch def 2361 /xindent exch def 2362 cvlit /to exch def 2363 cvlit /from exch def 2364 /toarrowlength exch def 2365 /fromarrowlength exch def 2366 2367 from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd 0 0 2368 fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef 2369 180 dg /FROM@ANGLE ldiagangledef 2370 to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd 0 0 2371 toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef 2372 0 dg /TO@ANGLE ldiagangledef 2373 /XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def 2374 /XP1 [ XLEFT FROM exch pop ] cvx def 2375 /XP2 [ XLEFT TO exch pop ] cvx def 2376 /VERT [ XP1 XP2 ldiagangleto ] cvx def 2377 XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2378 VERT /LMID@ANGLE ldiagangledef 2379 /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def 2380 /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def 2381 XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef 2382 180 dg /LFROM@ANGLE ldiagangledef 2383 ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef 2384 0 dg /LTO@ANGLE ldiagangledef 2385 /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def 2386 /XP1PRE [ XP1 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def 2387 /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def 2388 /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def 2389 XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd 2390 /P1 ldiagpointdef 2391 XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef 2392 /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def 2393 /XP2POST [ XP2 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def 2394 /XP2CTR [ XP2PRE 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def 2395 XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd 2396 /P2 ldiagpointdef 2397 XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef 2398 FROM LFROM XP1PRE 2399 { } { [XP1CTR] P1 [XP1CTR] } { } { [XP1CTR clockwise] P1 [XP1CTR clockwise] } 2400 { } { } { } { } VERT round ldiagquadcase 2401 XP1POST LMID XP2PRE 2402 { } { [XP2CTR] P2 [XP2CTR] } { } { [XP2CTR clockwise] P2 [XP2CTR clockwise] } 2403 { } { } { } { } VERT round ldiagquadcase 2404 XP2POST LTO TO 2405 2406 % (leaving ldiaglvrcurvepath) 0 ldiagdebugprint 2407 % count ( stack size is) 1 ldiagdebugprint pop 2408} def 2409 2410% farr tarr { from } { to } xindent zindent bias ldiagrvllinepath - 2411/ldiagrvllinepath 2412{ 2413 % (entering ldiagrvllinepath) 0 ldiagdebugprint 2414 % count ( stack size is) 1 ldiagdebugprint pop 2415 /bias exch def 2416 /zindent exch def 2417 /xindent exch def 2418 cvlit /to exch def 2419 cvlit /from exch def 2420 /toarrowlength exch def 2421 /fromarrowlength exch def 2422 2423 from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd 2424 0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef 2425 0 dg /FROM@ANGLE ldiagangledef 2426 to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd 2427 0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef 2428 180 dg /TO@ANGLE ldiagangledef 2429 /XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def 2430 XRIGHT FROM exch pop /P1 ldiagpointdef 2431 XRIGHT TO exch pop /P2 ldiagpointdef 2432 /VERT [ P1 P2 ldiagangleto ] cvx def 2433 P1 P1 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle 2434 ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef 2435 P2 P2 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle 2436 ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef 2437 P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2438 VERT /LMID@ANGLE ldiagangledef 2439 /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def 2440 /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def 2441 FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef 2442 0 dg /LFROM@ANGLE ldiagangledef 2443 TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef 2444 180 dg /LTO@ANGLE ldiagangledef 2445 FROM LFROM P1 LMID P2 LTO TO 2446 2447 % (leaving ldiagrvllinepath) 0 ldiagdebugprint 2448 % count ( stack size is) 1 ldiagdebugprint pop 2449} def 2450 2451 2452% farr tarr { from } { to } xindent zindent bias radius ldiagrvlcurvepath - 2453/ldiagrvlcurvepath 2454{ 2455 % (entering ldiagrvlcurvepath) 0 ldiagdebugprint 2456 % count ( stack size is) 1 ldiagdebugprint pop 2457 /radius exch def 2458 /bias exch def 2459 /zindent exch def 2460 /xindent exch def 2461 cvlit /to exch def 2462 cvlit /from exch def 2463 /toarrowlength exch def 2464 /fromarrowlength exch def 2465 2466 from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd 2467 0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef 2468 0 dg /FROM@ANGLE ldiagangledef 2469 to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd 2470 0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef 2471 180 dg /TO@ANGLE ldiagangledef 2472 /XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def 2473 /XP1 [ XRIGHT FROM exch pop ] cvx def 2474 /XP2 [ XRIGHT TO exch pop ] cvx def 2475 /VERT [ XP1 XP2 ldiagangleto ] cvx def 2476 XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2477 VERT /LMID@ANGLE ldiagangledef 2478 /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def 2479 /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def 2480 FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef 2481 0 dg /LFROM@ANGLE ldiagangledef 2482 TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef 2483 180 dg /LTO@ANGLE ldiagangledef 2484 /RADIUS [ radius XP1 XP2 ldiagdistance 0.5 mul ldiagmin ] cvx def 2485 /XP1PRE [ XP1 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def 2486 /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def 2487 /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def 2488 XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd 2489 /P1 ldiagpointdef 2490 XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef 2491 /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def 2492 /XP2POST [ XP2 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def 2493 /XP2CTR [ XP2PRE 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def 2494 XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd 2495 /P2 ldiagpointdef 2496 XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef 2497 FROM LFROM XP1PRE 2498 {} {[XP1CTR clockwise] P1 [XP1CTR clockwise]} {} {[XP1CTR] P1 [XP1CTR]} 2499 {} {} {} {} VERT round ldiagquadcase 2500 XP1POST LMID XP2PRE 2501 {} {[XP2CTR clockwise] P2 [XP2CTR clockwise]} {} {[XP2CTR] P2 [XP2CTR]} 2502 {} {} {} {} VERT round ldiagquadcase 2503 XP2POST LTO TO 2504 2505 % (leaving ldiagrvlcurvepath) 0 ldiagdebugprint 2506 % count ( stack size is) 1 ldiagdebugprint pop 2507} def 2508 2509% farr tarr { from } { to } xindent zindent bias ldiagdhulinepath - 2510/ldiagdhulinepath 2511{ 2512 % (entering ldiagdhulinepath) 0 ldiagdebugprint 2513 % count ( stack size is) 1 ldiagdebugprint pop 2514 /bias exch def 2515 /zindent exch def 2516 /xindent exch def 2517 cvlit /to exch def 2518 cvlit /from exch def 2519 /toarrowlength exch def 2520 /fromarrowlength exch def 2521 2522 from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd 2523 0 0 fromarrowlength 270 dg ldiagatangle ldiagpadd /FROM ldiagpointdef 2524 270 dg /FROM@ANGLE ldiagangledef 2525 2526 to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd 2527 0 0 toarrowlength 270 dg ldiagatangle ldiagpadd /TO ldiagpointdef 2528 90 dg /TO@ANGLE ldiagangledef 2529 2530 /XDOWN [ FROM exch pop TO exch pop ldiagmin bias sub ] cvx def 2531 FROM pop XDOWN /P1 ldiagpointdef 2532 TO pop XDOWN /P2 ldiagpointdef 2533 /HORIZ [ P1 P2 ldiagangleto ] cvx def 2534 P1 P1 0 0 1 ft 270 dg ldiagatangle ldiagpadd 0 0 1 ft HORIZ ldiagatangle 2535 ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef 2536 P2 P2 0 0 1 ft 90 dg ldiagatangle ldiagpadd 0 0 1 ft HORIZ ldiagatangle 2537 ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef 2538 2539 P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2540 HORIZ /LMID@ANGLE ldiagangledef 2541 2542 /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def 2543 /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def 2544 0 XINDENT FROM ldiagpsub /LFROM ldiagpointdef 2545 270 dg /LFROM@ANGLE ldiagangledef 2546 0 ZINDENT TO ldiagpsub /LTO ldiagpointdef 2547 90 dg /LTO@ANGLE ldiagangledef 2548 2549 FROM LFROM P1 LMID P2 LTO TO 2550 2551 % (leaving ldiagdhulinepath) 0 ldiagdebugprint 2552 % count ( stack size is) 1 ldiagdebugprint pop 2553} def 2554 2555% farr tarr { from } { to } xindent zindent bias radius ldiagdhucurvepath - 2556/ldiagdhucurvepath 2557{ 2558 % (entering ldiagdhucurvepath) 0 ldiagdebugprint 2559 % count ( stack size is) 1 ldiagdebugprint pop 2560 /radius exch def 2561 /bias exch def 2562 /zindent exch def 2563 /xindent exch def 2564 cvlit /to exch def 2565 cvlit /from exch def 2566 /toarrowlength exch def 2567 /fromarrowlength exch def 2568 2569 from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd 0 0 2570 fromarrowlength 270 dg ldiagatangle ldiagpadd /FROM ldiagpointdef 2571 270 dg /FROM@ANGLE ldiagangledef 2572 to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd 0 0 2573 toarrowlength 270 dg ldiagatangle ldiagpadd /TO ldiagpointdef 2574 90 dg /TO@ANGLE ldiagangledef 2575 /XDOWN [ FROM exch pop TO exch pop ldiagmin bias sub ] cvx def 2576 /XP1 [ FROM pop XDOWN ] cvx def 2577 /XP2 [ TO pop XDOWN ] cvx def 2578 /HORIZ [ XP1 XP2 ldiagangleto ] cvx def 2579 XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2580 HORIZ /LMID@ANGLE ldiagangledef 2581 /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def 2582 /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def 2583 0 XINDENT FROM ldiagpsub /LFROM ldiagpointdef 2584 270 dg /LFROM@ANGLE ldiagangledef 2585 0 ZINDENT TO ldiagpsub /LTO ldiagpointdef 2586 90 dg /LTO@ANGLE ldiagangledef 2587 /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def 2588 /XP1PRE [ XP1 0 0 RADIUS 90 dg ldiagatangle ldiagpadd ] cvx def 2589 /XP1POST [ XP1 0 0 RADIUS HORIZ ldiagatangle ldiagpadd ] cvx def 2590 /XP1CTR [ XP1PRE 0 0 RADIUS HORIZ ldiagatangle ldiagpadd ] cvx def 2591 XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd 2592 /P1 ldiagpointdef 2593 XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef 2594 /XP2PRE [ 0 0 RADIUS HORIZ ldiagatangle XP2 ldiagpsub ] cvx def 2595 /XP2POST [ XP2 0 0 RADIUS 90 dg ldiagatangle ldiagpadd ] cvx def 2596 /XP2CTR [ XP2PRE 0 0 RADIUS 90 dg ldiagatangle ldiagpadd ] cvx def 2597 XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd 2598 /P2 ldiagpointdef 2599 XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef 2600 FROM LFROM XP1PRE 2601 {} {} { [XP1CTR clockwise] P1 [XP1CTR clockwise] } {} { [XP1CTR] P1 [XP1CTR] } 2602 {} {} {} HORIZ round ldiagquadcase 2603 XP1POST LMID XP2PRE 2604 {} {} { [XP2CTR clockwise ] P2 [XP2CTR clockwise ] } {} { [XP2CTR] P2 [XP2CTR] } 2605 {} {} {} HORIZ round ldiagquadcase 2606 XP2POST LTO TO 2607 2608 % (leaving ldiagdhucurvepath) 0 ldiagdebugprint 2609 % count ( stack size is) 1 ldiagdebugprint pop 2610} def 2611 2612% farr tarr { from } { to } xindent zindent bias ldiaguhdlinepath - 2613/ldiaguhdlinepath 2614{ 2615 % (entering ldiaguhdlinepath) 0 ldiagdebugprint 2616 % count ( stack size is) 1 ldiagdebugprint pop 2617 /bias exch def 2618 /zindent exch def 2619 /xindent exch def 2620 cvlit /to exch def 2621 cvlit /from exch def 2622 /toarrowlength exch def 2623 /fromarrowlength exch def 2624 2625 from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd 2626 0 0 fromarrowlength 90 dg ldiagatangle ldiagpadd /FROM ldiagpointdef 2627 90 dg /FROM@ANGLE ldiagangledef 2628 to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd 2629 0 0 toarrowlength 90 dg ldiagatangle ldiagpadd /TO ldiagpointdef 2630 270 dg /TO@ANGLE ldiagangledef 2631 /XUP [ FROM exch pop TO exch pop ldiagmax bias add ] cvx def 2632 FROM pop XUP /P1 ldiagpointdef 2633 TO pop XUP /P2 ldiagpointdef 2634 /HORIZ [ P1 P2 ldiagangleto ] cvx def 2635 P1 P1 0 0 1 ft 90 dg ldiagatangle ldiagpadd 0 0 1 ft HORIZ ldiagatangle 2636 ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef 2637 P2 P2 0 0 1 ft 270 dg ldiagatangle ldiagpadd 0 0 1 ft HORIZ ldiagatangle 2638 ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef 2639 P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2640 HORIZ /LMID@ANGLE ldiagangledef 2641 /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def 2642 /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def 2643 FROM 0 XINDENT ldiagpadd /LFROM ldiagpointdef 2644 90 dg /LFROM@ANGLE ldiagangledef 2645 TO 0 ZINDENT ldiagpadd /LTO ldiagpointdef 2646 270 dg /LTO@ANGLE ldiagangledef 2647 FROM LFROM P1 LMID P2 LTO TO 2648 2649 % (leaving ldiaguhdlinepath) 0 ldiagdebugprint 2650 % count ( stack size is) 1 ldiagdebugprint pop 2651} def 2652 2653 2654% farr tarr { from } { to } xindent zindent bias radius ldiaguhdcurvepath - 2655/ldiaguhdcurvepath 2656{ 2657 % (entering ldiaguhdcurvepath) 0 ldiagdebugprint 2658 % count ( stack size is) 1 ldiagdebugprint pop 2659 /radius exch def 2660 /bias exch def 2661 /zindent exch def 2662 /xindent exch def 2663 cvlit /to exch def 2664 cvlit /from exch def 2665 /toarrowlength exch def 2666 /fromarrowlength exch def 2667 2668 from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd 2669 0 0 fromarrowlength 90 dg ldiagatangle ldiagpadd /FROM ldiagpointdef 2670 90 dg /FROM@ANGLE ldiagangledef 2671 to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd 2672 0 0 toarrowlength 90 dg ldiagatangle ldiagpadd /TO ldiagpointdef 2673 270 dg /TO@ANGLE ldiagangledef 2674 /XUP [ FROM exch pop TO exch pop ldiagmax bias add ] cvx def 2675 /XP1 [ FROM pop XUP ] cvx def 2676 /XP2 [ TO pop XUP ] cvx def 2677 /HORIZ [ XP1 XP2 ldiagangleto ] cvx def 2678 XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2679 HORIZ /LMID@ANGLE ldiagangledef 2680 /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def 2681 /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def 2682 FROM 0 XINDENT ldiagpadd /LFROM ldiagpointdef 2683 90 dg /LFROM@ANGLE ldiagangledef 2684 TO 0 ZINDENT ldiagpadd /LTO ldiagpointdef 2685 270 dg /LTO@ANGLE ldiagangledef 2686 /RADIUS [ radius XP1 XP2 ldiagdistance 0.5 mul ldiagmin ] cvx def 2687 /XP1PRE [ XP1 0 0 RADIUS 270 dg ldiagatangle ldiagpadd ] cvx def 2688 /XP1POST [ XP1 0 0 RADIUS HORIZ ldiagatangle ldiagpadd ] cvx def 2689 /XP1CTR [ XP1PRE 0 0 RADIUS HORIZ ldiagatangle ldiagpadd ] cvx def 2690 XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd 2691 /P1 ldiagpointdef 2692 XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef 2693 /XP2PRE [ 0 0 RADIUS HORIZ ldiagatangle XP2 ldiagpsub ] cvx def 2694 /XP2POST [ XP2 0 0 RADIUS 270 dg ldiagatangle ldiagpadd ] cvx def 2695 /XP2CTR [ XP2PRE 0 0 RADIUS 270 dg ldiagatangle ldiagpadd ] cvx def 2696 XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd 2697 /P2 ldiagpointdef 2698 XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef 2699 FROM LFROM XP1PRE 2700 {} {} {[XP1CTR] P1 [XP1CTR]} {} {[XP1CTR clockwise] P1 [XP1CTR clockwise]} 2701 {} {} {} HORIZ round ldiagquadcase 2702 XP1POST LMID XP2PRE 2703 {} {} {[XP2CTR] P2 [XP2CTR]} {} {[XP2CTR clockwise] P2 [XP2CTR clockwise]} 2704 {} {} {} HORIZ round ldiagquadcase 2705 XP2POST LTO TO 2706 2707 % (leaving ldiaguhdcurvepath) 0 ldiagdebugprint 2708 % count ( stack size is) 1 ldiagdebugprint pop 2709} def 2710 2711% farr tarr { from } { to } xindent zindent hfrac hbias ldiaghvhlinepath - 2712/ldiaghvhlinepath % still to do 2713{ 2714 % (entering ldiaghvhlinepath) 0 ldiagdebugprint 2715 % count ( stack size is) 1 ldiagdebugprint pop 2716 /hbias exch def 2717 /hfrac exch def 2718 /zindent exch def 2719 /xindent exch def 2720 cvlit /to exch def 2721 cvlit /from exch def 2722 /toarrowlength exch def 2723 /fromarrowlength exch def 2724 2725 /FRDIRN [ { 0 dg } { 180 dg } { 180 dg } { 0 dg } 2726 { 0 dg } { 0 dg } { 180 dg } { 180 dg } 2727 from (CTR) ldiagdolabel to (CTR) ldiagdolabel 2728 ldiagangleto ldiagquadcase ] cvx def 2729 /TODIRN [ FRDIRN 180 dg add ] cvx def 2730 from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd 2731 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef 2732 FRDIRN /FROM@ANGLE ldiagangledef 2733 to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd 2734 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef 2735 FRDIRN /TO@ANGLE ldiagangledef 2736 /BIAS [ FROM pop TO pop sub abs hfrac mul hbias add ] cvx def 2737 FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd /P1 ldiagpointdef 2738 P1 pop TO exch pop /P2 ldiagpointdef 2739 P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2740 P1 P2 ldiagangleto /LMID@ANGLE ldiagangledef 2741 /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def 2742 /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def 2743 FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef 2744 FRDIRN /LFROM@ANGLE ldiagangledef 2745 TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef 2746 FRDIRN /LTO@ANGLE ldiagangledef 2747 FROM LFROM P1 LMID P2 LTO TO 2748 2749 % (leaving ldiaghvhlinepath) 0 ldiagdebugprint 2750 % count ( stack size is) 1 ldiagdebugprint pop 2751} def 2752 2753 2754% farr tarr { from } { to } xindent zindent hfrac hbias radius ldiaghvhcurvepath - 2755/ldiaghvhcurvepath % still to do 2756{ 2757 % (entering ldiaghvhcurvepath) 0 ldiagdebugprint 2758 % count ( stack size is) 1 ldiagdebugprint pop 2759 /radius exch def 2760 /hbias exch def 2761 /hfrac exch def 2762 /zindent exch def 2763 /xindent exch def 2764 cvlit /to exch def 2765 cvlit /from exch def 2766 /toarrowlength exch def 2767 /fromarrowlength exch def 2768 2769 /FRDIRN [ { 0 dg } { 180 dg } { 180 dg } { 0 dg } 2770 { 0 dg } { 0 dg } { 180 dg } { 180 dg } 2771 from (CTR) ldiagdolabel to (CTR) ldiagdolabel 2772 ldiagangleto ldiagquadcase ] cvx def 2773 /TODIRN [ FRDIRN 180 dg add ] cvx def 2774 2775 from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd 2776 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef 2777 FRDIRN /FROM@ANGLE ldiagangledef 2778 to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd 2779 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef 2780 2781 FRDIRN /TO@ANGLE ldiagangledef 2782 /BIAS [ FROM pop TO pop sub abs hfrac mul hbias add ] cvx def 2783 /XP1 [ FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd ] cvx def 2784 /XP2 [ XP1 pop TO exch pop ] cvx def 2785 XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2786 /VERT [ XP1 XP2 ldiagangleto round ] cvx def 2787 VERT /LMID@ANGLE ldiagangledef 2788 /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def 2789 /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def 2790 FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef 2791 FRDIRN /LFROM@ANGLE ldiagangledef 2792 TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef 2793 FRDIRN /LTO@ANGLE ldiagangledef 2794 /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def 2795 /XP1PRE [ XP1 0 0 RADIUS TODIRN ldiagatangle ldiagpadd ] cvx def 2796 /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def 2797 /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def 2798 XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef 2799 XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef 2800 /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def 2801 /XP2POST [ XP2 0 0 RADIUS FRDIRN ldiagatangle ldiagpadd ] cvx def 2802 /XP2CTR [ 0 0 RADIUS VERT ldiagatangle XP2POST ldiagpsub ] cvx def 2803 XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef 2804 XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef 2805 VERT FRDIRN sub 90 eq 2806 { /P1GO [ anticlockwise ] cvx def /P2GO [ clockwise ] cvx def } 2807 { /P1GO [ clockwise ] cvx def /P2GO [ anticlockwise ] cvx def } 2808 ifelse 2809 FROM LFROM 2810 XP1PRE [XP1CTR P1GO] P1 [XP1CTR P1GO] XP1POST 2811 LMID 2812 XP2PRE [XP2CTR P2GO] P2 [XP2CTR P2GO] XP2POST 2813 LTO TO 2814 2815 % (leaving ldiaghvhcurvepath) 0 ldiagdebugprint 2816 % count ( stack size is) 1 ldiagdebugprint pop 2817} def 2818 2819% farr tarr { from } { to } xindent zindent hfrac hbias ldiagvhvlinepath - 2820/ldiagvhvlinepath % still to do 2821{ 2822 % (entering ldiagvhvlinepath) 0 ldiagdebugprint 2823 % count ( stack size is) 1 ldiagdebugprint pop 2824 /hbias exch def 2825 /hfrac exch def 2826 /zindent exch def 2827 /xindent exch def 2828 cvlit /to exch def 2829 cvlit /from exch def 2830 /toarrowlength exch def 2831 /fromarrowlength exch def 2832 2833 /FRDIRN [ { 90 dg } { 270 dg } { 270 dg } { 0 dg } 2834 { 90 dg } { 270 dg } { 270 dg } { 90 dg } 2835 from (CTR) ldiagdolabel to (CTR) ldiagdolabel 2836 ldiagangleto ldiagquadcase ] cvx def 2837 /TODIRN [ FRDIRN 180 dg sub ] cvx def 2838 from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd 2839 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef 2840 FRDIRN /FROM@ANGLE ldiagangledef 2841 to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd 2842 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef 2843 FRDIRN /TO@ANGLE ldiagangledef 2844 /BIAS [ FROM exch pop TO exch pop sub abs hfrac mul hbias ft add ] cvx def 2845 FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd /P1 ldiagpointdef 2846 TO pop P1 exch pop /P2 ldiagpointdef 2847 P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2848 P1 P2 ldiagangleto /LMID@ANGLE ldiagangledef 2849 /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def 2850 /ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def 2851 FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef 2852 FRDIRN /LFROM@ANGLE ldiagangledef 2853 TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef 2854 FRDIRN /LTO@ANGLE ldiagangledef 2855 FROM LFROM P1 LMID P2 LTO TO 2856 2857 % (leaving ldiagvhvlinepath) 0 ldiagdebugprint 2858 % count ( stack size is) 1 ldiagdebugprint pop 2859} def 2860 2861 2862% farr tarr { from } { to } xindent zindent hfrac hbias radius ldiagvhvcurvepath - 2863/ldiagvhvcurvepath % still to do 2864{ 2865 % (entering ldiagvhvcurvepath) 0 ldiagdebugprint 2866 % count ( stack size is) 1 ldiagdebugprint pop 2867 /radius exch def 2868 /hbias exch def 2869 /hfrac exch def 2870 /zindent exch def 2871 /xindent exch def 2872 cvlit /to exch def 2873 cvlit /from exch def 2874 /toarrowlength exch def 2875 /fromarrowlength exch def 2876 2877 /FRDIRN [ { 90 dg } { 270 dg } { 270 dg } { 0 dg } 2878 { 90 dg } { 270 dg } { 270 dg } { 90 dg } 2879 from (CTR) ldiagdolabel to (CTR) ldiagdolabel 2880 ldiagangleto ldiagquadcase ] cvx def 2881 /TODIRN [ FRDIRN 180 dg sub ] cvx def 2882 from (CTR) ldiagdolabel FRDIRN from (CIRCUM) ldiagdolabel ldiagpadd 2883 0 0 fromarrowlength FRDIRN ldiagatangle ldiagpadd /FROM ldiagpointdef 2884 FRDIRN /FROM@ANGLE ldiagangledef 2885 to (CTR) ldiagdolabel TODIRN to (CIRCUM) ldiagdolabel ldiagpadd 2886 0 0 toarrowlength TODIRN ldiagatangle ldiagpadd /TO ldiagpointdef 2887 FRDIRN /TO@ANGLE ldiagangledef 2888 /BIAS [ FROM exch pop TO exch pop sub abs hfrac mul hbias add ] cvx def 2889 /XP1 [ FROM 0 0 BIAS FRDIRN ldiagatangle ldiagpadd ] cvx def 2890 /XP2 [ TO pop XP1 exch pop ] cvx def 2891 XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2892 /VERT [ XP1 XP2 ldiagangleto round ] cvx def 2893 VERT /LMID@ANGLE ldiagangledef 2894 /XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def 2895 /ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def 2896 FROM 0 0 XINDENT FRDIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef 2897 FRDIRN /LFROM@ANGLE ldiagangledef 2898 TO 0 0 ZINDENT TODIRN ldiagatangle ldiagpadd /LTO ldiagpointdef 2899 FRDIRN /LTO@ANGLE ldiagangledef 2900 /RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def 2901 /XP1PRE [ XP1 0 0 RADIUS TODIRN ldiagatangle ldiagpadd ] cvx def 2902 /XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def 2903 /XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def 2904 XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef 2905 XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef 2906 /XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def 2907 /XP2POST [ XP2 0 0 RADIUS FRDIRN ldiagatangle ldiagpadd ] cvx def 2908 /XP2CTR [ 0 0 RADIUS VERT ldiagatangle XP2POST ldiagpsub ] cvx def 2909 XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef 2910 XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef 2911 FRDIRN VERT sub 90 eq 2912 { /P1GO [ clockwise ] cvx def /P2GO [ anticlockwise ] cvx def } 2913 { /P1GO [ anticlockwise ] cvx def /P2GO [ clockwise ] cvx def } 2914 ifelse 2915 FROM LFROM 2916 XP1PRE [XP1CTR P1GO] P1 [XP1CTR P1GO] XP1POST 2917 LMID 2918 XP2PRE [XP2CTR P2GO] P2 [XP2CTR P2GO] XP2POST 2919 LTO TO 2920 2921 2922 % (leaving ldiagvhvcurvepath) 0 ldiagdebugprint 2923 % count ( stack size is) 1 ldiagdebugprint pop 2924} def 2925 2926% farr tarr { from } { to } xindent zindent bias fbias tbias ldiagdwraplinepath - 2927/ldiagdwraplinepath 2928{ 2929 % (entering ldiagdwraplinepath) 0 ldiagdebugprint 2930 % count ( stack size is) 1 ldiagdebugprint pop 2931 /tbias exch def 2932 /fbias exch def 2933 /bias exch def 2934 /zindent exch def 2935 /xindent exch def 2936 cvlit /to exch def 2937 cvlit /from exch def 2938 /toarrowlength exch def 2939 /fromarrowlength exch def 2940 2941 /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop 2942 lt { 180 dg } { 0 dg } ifelse ] cvx def 2943 from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd 0 0 2944 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef 2945 DIRN /FROM@ANGLE ldiagangledef 2946 to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd 2947 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef 2948 DIRN /TO@ANGLE ldiagangledef 2949 FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd /P1 ldiagpointdef 2950 DIRN 180 dg eq { 225 dg } { -45 dg } ifelse /P1@ANGLE ldiagangledef 2951 TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd 2952 /P4 ldiagpointdef 2953 DIRN 180 dg eq { 135 dg } { 45 dg } ifelse /P4@ANGLE ldiagangledef 2954 /YC [ from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd 2955 exch pop to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd 2956 exch pop ldiagmin bias 0 ldiagmax sub ] cvx def 2957 P1 pop YC /P2 ldiagpointdef 2958 P4@ANGLE 180 dg sub /P2@ANGLE ldiagangledef 2959 P4 pop YC /P3 ldiagpointdef 2960 P1@ANGLE 180 dg sub /P3@ANGLE ldiagangledef 2961 /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def 2962 FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef 2963 FROM@ANGLE /LFROM@ANGLE ldiagangledef 2964 /ZINDENT [ zindent TO P4 ldiagdistance ldiagmin ] cvx def 2965 TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef 2966 TO@ANGLE /LTO@ANGLE ldiagangledef 2967 P2 0.5 ldiagpmul P3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 2968 DIRN 180 dg sub /LMID@ANGLE ldiagangledef 2969 FROM P1 P2 P3 P4 TO 2970 2971 % (leaving ldiagdwraplinepath) 0 ldiagdebugprint 2972 % count ( stack size is) 1 ldiagdebugprint pop 2973} def 2974 2975% farr tarr { from } { to } xindent zindent bias fbias tbias radius 2976% ldiagdwrapcurvepath - 2977/ldiagdwrapcurvepath 2978{ 2979 % (entering ldiagdwrapcurvepath) 0 ldiagdebugprint 2980 % count ( stack size is) 1 ldiagdebugprint pop 2981 /radius exch def 2982 /tbias exch def 2983 /fbias exch def 2984 /bias exch def 2985 /zindent exch def 2986 /xindent exch def 2987 cvlit /to exch def 2988 cvlit /from exch def 2989 /toarrowlength exch def 2990 /fromarrowlength exch def 2991 2992 /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt 2993 { 180 dg } { 0 dg } ifelse ] cvx def 2994 /CLOCK [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt 2995 { anticlockwise } { clockwise } ifelse ] cvx def 2996 from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd 2997 0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef 2998 DIRN /FROM@ANGLE ldiagangledef 2999 to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd 3000 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef 3001 DIRN /TO@ANGLE ldiagangledef 3002 /XP1 [ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd ] cvx def 3003 /XP4 [ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd ] cvx def 3004 /YC [ from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd 3005 exch pop to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd 3006 exch pop ldiagmin bias 0 ldiagmax sub ] cvx def 3007 /XP2 [ XP1 pop YC ] cvx def 3008 /XP3 [ XP4 pop YC ] cvx def 3009 /RP1 [ radius XP1 FROM ldiagdistance XP1 XP2 ldiagdistance 2 div 3010 ldiagmin ldiagmin ] cvx def 3011 /XP1PRE [ XP1 0 0 RP1 XP1 FROM ldiagangleto ldiagatangle ldiagpadd ] cvx def 3012 /XP1POST [ XP1 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3013 /XP1CTR [ XP1PRE 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3014 XP1CTR 0 0 RP1 XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef 3015 XP1CTR P1 ldiagangleto DIRN add 90 dg sub /P1@ANGLE ldiagangledef 3016 /RP2 [ radius XP1 XP2 ldiagdistance 2 div XP2 XP3 ldiagdistance 2 div 3017 ldiagmin ldiagmin ] cvx def 3018 /XP2PRE [ XP2 0 0 RP2 XP2 XP1 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3019 /XP2POST [ XP2 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3020 /XP2CTR [ XP2PRE 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3021 XP2CTR 0 0 RP2 XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef 3022 XP2CTR P2 ldiagangleto DIRN add 90 dg sub /P2@ANGLE ldiagangledef 3023 /RP3 [ radius XP2 XP3 ldiagdistance 2 div XP3 XP4 ldiagdistance 2 div 3024 ldiagmin ldiagmin ] cvx def 3025 /XP3PRE [ XP3 0 0 RP3 XP3 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3026 /XP3POST [ XP3 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3027 /XP3CTR [ XP3PRE 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3028 XP3CTR 0 0 RP3 XP3CTR XP3 ldiagangleto ldiagatangle ldiagpadd /P3 ldiagpointdef 3029 XP3CTR P3 ldiagangleto DIRN add 90 dg sub /P3@ANGLE ldiagangledef 3030 /RP4 [ radius XP4 XP3 ldiagdistance 2 div XP4 TO ldiagdistance 3031 ldiagmin ldiagmin ] cvx def 3032 /XP4PRE [ XP4 0 0 RP4 XP4 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3033 /XP4POST [ XP4 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def 3034 /XP4CTR [ XP4PRE 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def 3035 XP4CTR 0 0 RP4 XP4CTR XP4 ldiagangleto ldiagatangle ldiagpadd /P4 ldiagpointdef 3036 XP4CTR P4 ldiagangleto DIRN add 90 dg sub /P4@ANGLE ldiagangledef 3037 /XINDENT [ xindent FROM XP1PRE ldiagdistance ldiagmin ] cvx def 3038 FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef 3039 FROM@ANGLE /LFROM@ANGLE ldiagangledef 3040 XP2 0.5 ldiagpmul XP3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 3041 DIRN 180 dg sub /LMID@ANGLE ldiagangledef 3042 /ZINDENT [ zindent TO XP4POST ldiagdistance ldiagmin ] cvx def 3043 TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef 3044 TO@ANGLE /LTO@ANGLE ldiagangledef 3045 FROM LFROM 3046 XP1PRE [XP1CTR CLOCK] XP1POST 3047 XP2PRE [XP2CTR CLOCK] XP2POST 3048 LMID 3049 XP3PRE [XP3CTR CLOCK] XP3POST 3050 XP4PRE [XP4CTR CLOCK] XP4POST 3051 LTO TO 3052 3053 % (leaving ldiagdwrapcurvepath) 0 ldiagdebugprint 3054 % count ( stack size is) 1 ldiagdebugprint pop 3055} def 3056 3057% farr tarr { from } { to } xindent zindent bias fbias tbias ldiaguwraplinepath - 3058/ldiaguwraplinepath 3059{ 3060 % (entering ldiaguwraplinepath) 0 ldiagdebugprint 3061 % count ( stack size is) 1 ldiagdebugprint pop 3062 /tbias exch def 3063 /fbias exch def 3064 /bias exch def 3065 /zindent exch def 3066 /xindent exch def 3067 cvlit /to exch def 3068 cvlit /from exch def 3069 /toarrowlength exch def 3070 /fromarrowlength exch def 3071 3072 /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt 3073 { 180 dg } { 0 dg } ifelse ] cvx def 3074 from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd 3075 0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef 3076 DIRN /FROM@ANGLE ldiagangledef 3077 to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd 3078 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef 3079 DIRN /TO@ANGLE ldiagangledef 3080 FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd /P1 ldiagpointdef 3081 DIRN 180 dg eq { 135 dg } { 45 dg } ifelse /P1@ANGLE ldiagangledef 3082 TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd 3083 /P4 ldiagpointdef 3084 DIRN 180 dg eq { 225 dg } { -45 dg } ifelse /P4@ANGLE ldiagangledef 3085 /YC [ from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd 3086 exch pop to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd 3087 exch pop ldiagmax bias 0 ldiagmax add ] cvx def 3088 P1 pop YC /P2 ldiagpointdef 3089 P4@ANGLE 180 dg sub /P2@ANGLE ldiagangledef 3090 P4 pop YC /P3 ldiagpointdef 3091 P1@ANGLE 180 dg sub /P3@ANGLE ldiagangledef 3092 /XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def 3093 FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef 3094 FROM@ANGLE /LFROM@ANGLE ldiagangledef 3095 /ZINDENT [ zindent TO P4 ldiagdistance ldiagmin ] cvx def 3096 TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef 3097 TO@ANGLE /LTO@ANGLE ldiagangledef 3098 P2 0.5 ldiagpmul P3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 3099 DIRN 180 dg sub /LMID@ANGLE ldiagangledef 3100 FROM P1 P2 P3 P4 TO 3101 3102 % (leaving ldiaguwraplinepath) 0 ldiagdebugprint 3103 % count ( stack size is) 1 ldiagdebugprint pop 3104} def 3105 3106% farr tarr { from } { to } xindent zindent bias fbias tbias radius 3107% ldiaguwrapcurvepath - 3108/ldiaguwrapcurvepath 3109{ 3110 % (entering ldiaguwrapcurvepath) 0 ldiagdebugprint 3111 % count ( stack size is) 1 ldiagdebugprint pop 3112 /radius exch def 3113 /tbias exch def 3114 /fbias exch def 3115 /bias exch def 3116 /zindent exch def 3117 /xindent exch def 3118 cvlit /to exch def 3119 cvlit /from exch def 3120 /toarrowlength exch def 3121 /fromarrowlength exch def 3122 3123 /DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt 3124 { 180 dg } { 0 dg } ifelse ] cvx def 3125 /CLOCK [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt 3126 { clockwise } { anticlockwise } ifelse ] cvx def 3127 from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd 3128 0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef 3129 DIRN /FROM@ANGLE ldiagangledef 3130 to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd 3131 0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef 3132 DIRN /TO@ANGLE ldiagangledef 3133 /XP1 [ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd ] cvx def 3134 /XP4 [ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd ] cvx def 3135 /YC [ from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd 3136 exch pop to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd 3137 exch pop ldiagmax bias 0 ldiagmax add ] cvx def 3138 /XP2 [ XP1 pop YC ] cvx def 3139 /XP3 [ XP4 pop YC ] cvx def 3140 /RP1 [ radius XP1 FROM ldiagdistance XP1 XP2 ldiagdistance 2 div 3141 ldiagmin ldiagmin ] cvx def 3142 /XP1PRE [ XP1 0 0 RP1 XP1 FROM ldiagangleto ldiagatangle ldiagpadd ] cvx def 3143 /XP1POST [ XP1 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3144 /XP1CTR [ XP1PRE 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3145 XP1CTR 0 0 RP1 XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef 3146 XP1CTR P1 ldiagangleto DIRN add 90 dg add /P1@ANGLE ldiagangledef 3147 /RP2 [ radius XP1 XP2 ldiagdistance 2 div XP2 XP3 ldiagdistance 2 div 3148 ldiagmin ldiagmin ] cvx def 3149 /XP2PRE [ XP2 0 0 RP2 XP2 XP1 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3150 /XP2POST [ XP2 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3151 /XP2CTR [ XP2PRE 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3152 XP2CTR 0 0 RP2 XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef 3153 XP2CTR P2 ldiagangleto DIRN add 90 dg add /P2@ANGLE ldiagangledef 3154 /RP3 [ radius XP2 XP3 ldiagdistance 2 div XP3 XP4 ldiagdistance 2 div 3155 ldiagmin ldiagmin ] cvx def 3156 /XP3PRE [ XP3 0 0 RP3 XP3 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3157 /XP3POST [ XP3 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3158 /XP3CTR [ XP3PRE 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3159 XP3CTR 0 0 RP3 XP3CTR XP3 ldiagangleto ldiagatangle ldiagpadd /P3 ldiagpointdef 3160 XP3CTR P3 ldiagangleto DIRN add 90 dg add /P3@ANGLE ldiagangledef 3161 /RP4 [ radius XP4 XP3 ldiagdistance 2 div XP4 TO ldiagdistance 3162 ldiagmin ldiagmin ] cvx def 3163 /XP4PRE [ XP4 0 0 RP4 XP4 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def 3164 /XP4POST [ XP4 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def 3165 /XP4CTR [ XP4PRE 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def 3166 XP4CTR 0 0 RP4 XP4CTR XP4 ldiagangleto ldiagatangle ldiagpadd /P4 ldiagpointdef 3167 XP4CTR P4 ldiagangleto DIRN add 90 dg add /P4@ANGLE ldiagangledef 3168 /XINDENT [ xindent FROM XP1PRE ldiagdistance ldiagmin ] cvx def 3169 FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef 3170 FROM@ANGLE /LFROM@ANGLE ldiagangledef 3171 XP2 0.5 ldiagpmul XP3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef 3172 DIRN 180 dg sub /LMID@ANGLE ldiagangledef 3173 /ZINDENT [ zindent TO XP4POST ldiagdistance ldiagmin ] cvx def 3174 TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef 3175 TO@ANGLE /LTO@ANGLE ldiagangledef 3176 FROM LFROM 3177 XP1PRE [XP1CTR CLOCK] XP1POST 3178 XP2PRE [XP2CTR CLOCK] XP2POST 3179 LMID 3180 XP3PRE [XP3CTR CLOCK] XP3POST 3181 XP4PRE [XP4CTR CLOCK] XP4POST 3182 LTO TO 3183 3184 % (leaving ldiaguwrapcurvepath) 0 ldiagdebugprint 3185 % count ( stack size is) 1 ldiagdebugprint pop 3186} def 3187 3188% shape and labels of the @SolidArrowHead symbol 3189% - ldiagsolidarrowhead - 3190/ldiagsolidarrowhead 3191{ 3192 0 0 xsize ysize 0.5 mul 0 ysize 3193} def 3194 3195% shape and labels of the @SolidWithBarArrowHead symbol 3196% <pathwidth> ldiagsolidwithbararrowhead - 3197/ldiagsolidwithbararrowhead 3198{ 3199 /pathwidth exch def 3200 /XBK [ xsize pathwidth 0.5 mul sub ] cvx def 3201 /XFW [ xsize pathwidth 0.5 mul add ] cvx def 3202 0 0 XBK ysize 0.5 mul XBK 0 XFW 0 XFW ysize 3203 XBK ysize XBK ysize 0.5 mul 0 ysize 0 0 3204} def 3205 3206% shape and labels of the @OpenArrowHead symbol 3207% <pathwidth> <pathgap> ldiagopenarrowhead - 3208/ldiagopenarrowhead 3209{ 3210 /pathgap exch def 3211 /pathwidth exch def 3212 /PSW [ 0 0 ] cvx def 3213 /PNW [ 0 ysize ] cvx def 3214 /PE [ xsize ysize 0.5 mul ] cvx def 3215 /REL [ 0 0 pathwidth PE PNW ldiagangleto 90 add ldiagatangle ] cvx def 3216 pathgap 0 eq 3217 { 3218 /PNA [ 0 ysize 0.5 mul pathwidth 0.5 mul add ] cvx def 3219 /PSA [ 0 ysize 0.5 mul pathwidth 0.5 mul sub ] cvx def 3220 /PNI [ PNA PNA xsize 0 ldiagpadd PNW REL ldiagpadd 3221 PE REL ldiagpadd ldiaglineintersect ] cvx def 3222 /PSI [ 0 pathwidth PNI ldiagpsub ] cvx def 3223 3224 PSW PE PNW PNI PNA PSA PSI PSW 3225 } 3226 { 3227 /PNA [ 0 ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul add ] cvx def 3228 /PSA [ 0 ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul sub ] cvx def 3229 /PNI [ PNA PNA xsize 0 ldiagpadd PNW REL ldiagpadd 3230 PE REL ldiagpadd ldiaglineintersect ] cvx def 3231 /PSI [ 0 pathwidth pathgap add PNI ldiagpsub ] cvx def 3232 /PXA [ 0 pathwidth PNA ldiagpsub ] cvx def 3233 /PXI [ 0 pathwidth PNI ldiagpsub ] cvx def 3234 /PYA [ 0 pathwidth PSA ldiagpadd ] cvx def 3235 /PYI [ 0 pathwidth PSI ldiagpadd ] cvx def 3236 3237 PSW PE PNW PNI PNA PXA PXI PYI PYA PSA PSI PSW 3238 } ifelse 3239} def 3240 3241% shape and labels of the @HalfOpenArrowHead symbol 3242% <pathwidth> <pathgap> ldiaghalfopenarrowhead - 3243/ldiaghalfopenarrowhead 3244{ 3245 /pathgap exch def 3246 /pathwidth exch def 3247 0 0 3248 xsize ysize 0.5 mul 3249 0 ysize 3250 pathgap 0 eq 3251 { 3252 xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul add 3253 0 ysize 0.5 mul pathwidth 0.5 mul add 3254 0 ysize 0.5 mul pathwidth 0.5 mul sub 3255 xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul sub 3256 } 3257 { 3258 xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul add 3259 0 ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul add 3260 0 ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul sub 3261 xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul add pathwidth 0.5 mul sub 3262 xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul add 3263 0 ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul add 3264 0 ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul sub 3265 xsize 0.3 mul ysize 0.5 mul pathgap 0.5 mul sub pathwidth 0.5 mul sub 3266 } ifelse 3267 0 0 3268} def 3269 3270% shape and labels of the @SolidCurvedArrowHead symbol 3271% - ldiagsolidcurvedarrowhead - 3272/ldiagsolidcurvedarrowhead 3273{ 3274 0 0 3275 [0 0 xsize ysize 0.5 mul ldiaglinebetween 3276 xsize 0 xsize ysize ldiaglineintersect clockwise] 3277 xsize ysize 0.5 mul 3278 [xsize ysize 0.5 mul 0 ysize ldiaglinebetween 3279 xsize 0 xsize ysize ldiaglineintersect clockwise] 3280 0 ysize 3281} def 3282 3283% shape and labels of the @OpenCurvedArrowHead symbol 3284% <pathwidth> <pathgap> ldiagopencurvedarrowhead - 3285/ldiagopencurvedarrowhead 3286{ 3287 /pathgap exch def 3288 /pathwidth exch def 3289 /LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween 3290 xsize 0 xsize ysize ldiaglineintersect 3291 ] cvx def 3292 /UR [ xsize ysize 0.5 mul 0 ysize ldiaglinebetween 3293 xsize 0 xsize ysize ldiaglineintersect 3294 ] cvx def 3295 /PW2 [ pathwidth 0.5 mul ] cvx def 3296 0 0 3297 [LR clockwise] 3298 xsize ysize 0.5 mul 3299 [UR clockwise] 3300 0 ysize 3301 pathgap 0 eq 3302 { 3303 /UMID [ 3304 0 ysize 0.5 mul PW2 add 3305 xsize ysize 0.5 mul PW2 add 3306 0 ysize 0 0 1 ft UR 0 ysize ldiagangleto 90 add ldiagatangle 3307 ldiagpadd 0 ysize ldiaglineintersect 3308 ] cvx def 3309 /LMID [ 0 pathwidth UMID ldiagpsub ] cvx def 3310 UMID 3311 0 ysize 0.5 mul PW2 add 3312 0 ysize 0.5 mul PW2 sub 3313 LMID 3314 } 3315 { 3316 /UMIDU [ 3317 0 ysize 0.5 mul PW2 add pathgap 0.5 mul add 3318 xsize ysize 0.5 mul PW2 add pathgap 0.5 mul add 3319 0 ysize 0 0 1 ft UR 0 ysize ldiagangleto 90 add ldiagatangle 3320 ldiagpadd 0 ysize ldiaglineintersect 3321 ] cvx def 3322 /UMIDL [ 0 pathwidth UMIDU ldiagpsub ] cvx def 3323 /LMIDL [ 0 pathgap 0 pathwidth UMIDU ldiagpsub ldiagpsub ] cvx def 3324 /LMIDU [ 0 pathwidth LMIDL ldiagpadd ] cvx def 3325 UMIDU 3326 0 UMIDU exch pop 3327 0 UMIDL exch pop 3328 UMIDL 3329 LMIDU 3330 0 LMIDU exch pop 3331 0 LMIDL exch pop 3332 LMIDL 3333 } ifelse 3334 0 0 3335} def 3336 3337% shape and labels of the @HalfOpenCurvedArrowHead symbol 3338% <pathwidth> <pathgap> ldiaghalfopencurvedarrowhead - 3339/ldiaghalfopencurvedarrowhead 3340{ 3341 /pathgap exch def 3342 /pathwidth exch def 3343 /LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween 3344 xsize 0 xsize ysize ldiaglineintersect 3345 ] cvx def 3346 /UR [ xsize ysize 0.5 mul 0 ysize ldiaglinebetween 3347 xsize 0 xsize ysize ldiaglineintersect 3348 ] cvx def 3349 /BR [ 0 0 LR 0 ysize UR ldiaglineintersect ] cvx def 3350 /BRAD [ 0 0 BR ldiagdistance ] cvx def 3351 /PW2 [ pathwidth 0.5 mul ] cvx def 3352 0 0 3353 [LR clockwise] 3354 xsize ysize 0.5 mul 3355 [UR clockwise] 3356 0 ysize 3357 [BR clockwise] 3358 pathgap 0 eq 3359 { 3360 /XDIST [ BRAD dup mul PW2 dup mul sub sqrt ] cvx def 3361 /UMID [ BR XDIST PW2 ldiagpadd ] cvx def 3362 /LMID [ BR XDIST 0 PW2 sub ldiagpadd ] cvx def 3363 UMID 3364 0 ysize 0.5 mul PW2 add 3365 0 ysize 0.5 mul PW2 sub 3366 LMID 3367 } 3368 { 3369 /XDIST [ BRAD dup mul PW2 dup mul sub sqrt ] cvx def 3370 /UMIDU [ BR XDIST PW2 pathgap 0.5 mul add ldiagpadd ] cvx def 3371 /UMIDL [ 0 pathwidth UMIDU ldiagpsub ] cvx def 3372 /LMIDL [ BR XDIST 0 PW2 sub pathgap 0.5 mul sub ldiagpadd ] cvx def 3373 /LMIDU [ 0 pathwidth LMIDL ldiagpadd ] cvx def 3374 UMIDU 3375 0 UMIDU exch pop 3376 0 UMIDL exch pop 3377 UMIDL 3378 LMIDU 3379 0 LMIDU exch pop 3380 0 LMIDL exch pop 3381 LMIDL 3382 } ifelse 3383 [BR clockwise] 3384 0 0 3385} def 3386 3387% shape and labels of the @ManyArrowHead symbol 3388% <pathwidth> ldiagmanyarrowhead - 3389/ldiagmanyarrowhead 3390{ 3391 /pathwidth exch def 3392 /LL [ 0 ysize 2 div pathwidth 2 div sub ] cvx def 3393 /LU [ 0 ysize 2 div pathwidth 2 div add ] cvx def 3394 LL 3395 xsize 0 3396 xsize pathwidth 3397 LU 3398 LL 3399 [] 3400 LL 3401 xsize LL exch pop 3402 xsize LU exch pop 3403 LU 3404 LL 3405 [] 3406 LL 3407 xsize ysize pathwidth sub 3408 xsize ysize 3409 LU 3410 LL 3411} def 3412 3413end 3414%%EndResource 3415