%! /intersection { 1 dict begin /L exch def /A L 0 get def /B L 1 get def /C L 2 get def /f00 A -1 mul B -1 mul add C add def /f10 A 1 mul B -1 mul add C add def /f11 A 1 mul B 1 mul add C add def /f01 A -1 mul B 1 mul add C add def % f01 f11 % f00 f10 [ f00 f10 mul 0 lt { [0 -1] } if f10 0 eq { [1 -1] } if f10 f11 mul 0 lt { [0 1] } if f11 0 eq { [1 1] } if f11 f01 mul 0 lt { [0 1] } if f01 0 eq { [-1 1] } if f01 f00 mul 0 lt { [-1 0] } if f00 0 eq { [-1 -1] } if ] end } def % --- sample usage --------------------------------------- /S 72 def S dup scale 1 S div setlinewidth 4.25 5.5 translate newpath -1 -1 moveto 1 -1 lineto 1 1 lineto -1 1 lineto closepath stroke /I [3 -1 2] intersection def I length 2 eq { newpath I 0 get 0 get I 0 get 1 get moveto I 1 get 0 get I 1 get 1 get lineto stroke } if