%require "common.ps"
/ptrn { % <x1> <y1> <x2> <y2> ... <xn> <yn> ptrn -
% first draw an bullet at first coordinate
count dup 2 sub roll
2 copy
newpath 2 0 360 arc F
M
count 0 gt { % is there more than one point?
% then a line for all but the last
count 2 idiv 1 sub {
count dup 2 sub roll L
} repeat
% only the last one left, where the arrow-head must be
7 dict begin
/y exch def
/x exch def
currentpoint y sub neg /dy exch def
x sub neg /dx exch def
/al dx dx mul dy dy mul add sqrt def
/angle dy dx atan def
/b al 7 sub def
gsave
currentpoint translate
angle rotate
b 0 L S
b -2.5 M b 2.5 L al 0 L CP F % arrow head
grestore
end
} if
} def
% <x1> <y> <x2> ptr1 -
/ptr1 { 1 index ptrn } def