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