home *** CD-ROM | disk | FTP | other *** search
- defineps loadPSProcedures()
- /xpos 0 def
- /ypos 0 def
- /ticklength [8 2 2 2 2 5 2 2 2 2] def
-
- % x
- /getticklength {10 idiv 10 mod abs ticklength exch get} def
-
-
- % x y length
- /vtick { moveto 0 exch rlineto stroke } def
- /htick { moveto 0 rlineto stroke } def
-
- % x
- /increase-x {/xpos xpos 10 add def} def
- /decrease-x {/xpos xpos 10 sub def} def
-
- % y
- /increase-y {/ypos ypos 10 add def} def
- /decrease-y {/ypos ypos 10 sub def} def
- endps
-
- defineps drawCircle(float x, y, radius)
- % describe the path of a circle
- newpath
- x y radius 0 360 arc
- closepath
- stroke
- endps
-
- defineps drawAxes(float x, y, width, height)
- gsave
- % set max and min of visible area
- /xmax x width add 1 sub def
- /ymax y height add def
- /ymin y 1 add def
- /xpos 0 def
- /ypos 0 def
-
- % draw border
- x ymin moveto
- x ymax lineto
- xmax ymax lineto
- xmax ymin lineto
- closepath
- stroke
-
- % now draw axes
- x 0 moveto
- xmax 0 lineto
- stroke
- 0 ymin moveto
- 0 ymax lineto
- stroke
- 0 0 moveto
- % draw the pos x ticks
- {xpos xmax le
- {xpos getticklength neg xpos 0 vtick increase-x}{exit} ifelse
- } loop
- % draw the neg x ticks
- 0 0 moveto
- {xpos x ge
- {xpos getticklength neg xpos 0 vtick decrease-x}{exit} ifelse
- } loop
- % draw the pos y ticks
- 0 0 moveto
- {ypos ymax le
- {ypos getticklength neg 0 ypos htick increase-y}{exit} ifelse
- } loop
- % draw the neg y ticks
- 0 0 moveto
- {ypos ymin ge
- {ypos getticklength neg 0 ypos htick decrease-y}{exit} ifelse
- } loop
- grestore
- endps