Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-10 - decus/20-189/coords.ps
There are no other files named coords.ps in the archive.
% This PS file defines some functions that look around, find the current
% coordinate system and clipping region, and draw a coordinate grid
% for it. Just drop it in to any PS context and it will cope.
%
% Brian Reid, Stanford
% April 1985

/Gdict 50 dict def Gdict begin
/Courier findfont 7 scalefont setfont
/rawshow {gsave
   currentpoint translate 0 0 transform
   /cm matrix currentmatrix def
   /ang 1 0 dtransform neg exch atan def
   initmatrix ang rotate itransform translate
   show
grestore} def

/rawstroke {
   /cm matrix currentmatrix def
   initmatrix stroke
   cm setmatrix
} def

/showgrid
{gsave
  2 setlinecap  0 setgray
  /y ymin def
  /ycount ymax ymin sub yincr idiv 1 add def
  ycount {newpath
    [3 3] 0 setdash
    y 0.0 eq {2 setlinewidth}{0.5 setlinewidth} ifelse
    xmin y moveto
    xmax y lineto rawstroke
    xorg y yincr 20 div add moveto y 20 string cvs rawshow
    /y y yincr add def
  } repeat
  /x xmin def
  /xcount xmax xmin sub xincr idiv 1 add def
  xcount {newpath
    x ymin moveto
    [10 5] 5 setdash
    x 0.0 eq {2 setlinewidth}{0.5 setlinewidth} ifelse
    x ymin moveto
    x ymax lineto rawstroke
    gsave x xincr 20 div add yorg  translate -90 rotate
        x 20 string cvs 0 0 moveto rawshow
    grestore
    /x x xincr add def
  } repeat
grestore} def

/findgrid {
    clippath pathbbox
    /ymax exch def /xmax exch def /ymin exch def /xmin exch def

    xmax xmin sub 10 div log 0.5 add truncate 10 exch exp /xincr exch def
    ymax ymin sub 10 div log 0.5 add truncate 10 exch exp /yincr exch def
    xincr 1 gt {/xincr xincr round def} if
    yincr 1 gt {/yincr yincr round def} if
    xmin xincr div dup 0 lt {2}{1} ifelse sub truncate
	xincr mul /xmin exch def
    ymin yincr div dup 0 lt {2}{1} ifelse sub truncate
	yincr mul /ymin exch def
} def

/findcenter {
  /xorg xmax xmin sub 2 div xmin add xincr div
	round xincr mul xincr 20 div add def
  /yorg ymax ymin sub 2 div ymin add yincr div
	round yincr mul yincr -20 div add def
} def

findgrid
findcenter
showgrid
end