|
|
1.1 root 1: %!PS-Adobe-2.0 EPSF-2.0
2: %%Title: arrows.eps
3: %%Creator: Adobe Systems Incorporated
4: %%Pages: 0 1
5: %%BoundingBox: 0 0 300 540
6: %%EndComments
7: %%BeginProcSet: arrows 1.0 0
8: % From: Green Book Listing 3-4, on page 47.
9:
10: % "arrowhead" takes these arguments:
11: % lineweight prevX prevY
12: /arrowhead { %def
13: gsave
14: currentpoint
15: 4 2 roll exch 4 -1 roll exch
16: sub 3 1 roll sub
17: exch atan rotate dup scale
18: -1 2 rlineto
19: 7 -2 rlineto
20: -7 -2 rlineto
21: closepath fill
22: grestore
23: newpath
24: } bind def
25: /l^ { %def % lineto-arrow
26: currentlinewidth currentpoint 5 3 roll
27: lineto
28: currentpoint stroke moveto
29: arrowhead
30: } bind def
31: /rl^ { %def % rlineto-arrow
32: currentlinewidth currentpoint 5 3 roll
33: rlineto
34: currentpoint stroke moveto
35: arrowhead
36: } bind def
37: /arc^ { %def % arc-arrow
38: 5 copy arc
39: currentpoint stroke moveto % stroke arc
40: % getting the correct orientation for the arrowhead
41: % is tricky. This procedure uses the arguments to
42: % "arc" to determine the tangent of the curve at the
43: % endpoint, and it orients the arrowhead along that
44: % tangent line. It leaves an X-Y point that is just
45: % behind the arrowhead along the tangent.
46: % newX = X + radius * cos(endAngle-1)
47: % newY = Y + radius * sin(endAngle-1)
48: exch pop 1 sub % endAngle - 1 degree
49: dup cos 2 index mul 4 index add % arrowX
50: exch sin 2 index mul 3 index add % arrowY
51: currentlinewidth 2 add 3 1 roll % thickness
52: arrowhead pop pop pop % draw -\>
53: } bind def
54: %%EndProcSet: arrows 1.0 0
55: %%EndProlog
56: % line sample:
57: 150 420 moveto
58: 0 10 360 {
59: currentlinewidth .1 add setlinewidth
60: gsave
61: dup cos 100 mul
62: exch sin 100 mul
63: rl^
64: grestore
65: } bind for
66: newpath
67: % curve sample:
68: /radius 10 def .1 setlinewidth
69: 0 30 360 {
70: /radius radius 10 add def
71: 150 150 radius 0 5 -1 roll arc^
72: } bind for
73: showpage
74: %%Trailer
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.