home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume12 / ln03-plot / manual.txt < prev    next >
Encoding:
Text File  |  1987-10-25  |  6.7 KB  |  240 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.                                   USERS GUIDE
  14.                                       FOR
  15.                                  PLOT FILTERS
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.                                   David Chang
  34.  
  35.                              Nicholas Christopher
  36.  
  37.                                  16 June 1987
  38.  
  39.  
  40.  
  41. 1. INTRODUCTION TO PLOT FILTERS
  42.  The UNIX operating system has, as one of its standard libraries, a library
  43. which produces graphics output in a device-independent manner.  This output
  44. can then be used as input for any compatible device-specific plot filter.
  45. The plot filter generates commands, that when redirected to its
  46. corresponding graphics device, will generate the desired graphics output.
  47.  
  48. The graphics library should be linked to your C program by using the -lplot
  49. compiler switch.
  50.  
  51.  
  52.  
  53. 2. COMMANDS
  54. The subroutines that are included in the standard UNIX Plot library
  55. are as follows:
  56.  
  57.    - openpl() 
  58.      Prepares the output device for taking 
  59.      commands.  It should always be called 
  60.      before calling any other plot subroutines.
  61.  
  62.    - erase() 
  63.      Reinitializes the output device. 
  64.  
  65.    - label(s) char[s]; 
  66.      Places text in the output at the current 
  67.      point. It takes a string variable or a string 
  68.      in quotes as its argument.  The argument is 
  69.      null-terminated and does not contain newlines.  
  70.      A local modification of the command allows the 
  71.      LN03 to use its technical font. To use the LN03 
  72.      technical font begin the label with a tilde 
  73.      character ("~"). A space-tilde, " ~", will 
  74.      allow a label in the regular font to begin 
  75.      with a tilde.
  76.  
  77.    - line(x1,y1,x2,y2)
  78.      Produces a line that starts at the point 
  79.      designated by the first two arguments that are 
  80.      passed to the subroutine and terminates at the 
  81.      point designated by the final two arguments.
  82.  
  83.    - circle(x,y,r) 
  84.      Produces a circle whose center is given by the 
  85.      first two arguments and whose radius is given 
  86.      by the final argument.
  87.  
  88.    - arc(x,y,x1,y1,x2,y2) 
  89.      Produces an arc whose center is determined by 
  90.      the first two arguments. The starting 
  91.      point is given by the third and fourth 
  92.      arguments and the end point is given by the 
  93.      final two arguments.  The arc is drawn 
  94.      counter-clockwise.
  95.  
  96.    - move(x,y) 
  97.      Changes the current point to the point given 
  98.      by the two arguments.
  99.  
  100.    - cont(x,y) 
  101.      Draws a point from the current point to the 
  102.      point given by the two arguments.
  103.  
  104.    - point(x,y) 
  105.      Draws a single point at the given coordinates.
  106.  
  107.    - linemod(s) char[s]; 
  108.      Changes the line style to the given style.  
  109.      the styles that are available are `dotted', 
  110.      `longdashed', `shortdashed', and `dotdashed'.
  111.  
  112.    - space(x1,y1,x2,y2) 
  113.      Changes the plot area, using the first two 
  114.      coordinates as the upper right hand corner of 
  115.      the plotting area and the final two arguments 
  116.      as the lower left hand corner of the plotting 
  117.      area.  The plot will be reduced or magnified 
  118.      to fit the device as closely as possible.
  119.  
  120.    - closepl() 
  121.      Closes the output device.  This should always 
  122.      be called at the end of your program.
  123.  
  124. There are two subroutines that have been added to the standard Plot
  125. library here at Columbia.  They are as follows:
  126.  
  127.    - box(x1,y1,x2,y2)
  128.      Draws a box using the two points that are 
  129.      passed as arguments as two corners.  This 
  130.      available on all the devices.
  131.  
  132.    - color(n) 
  133.      Changes the pen on a multicolor pen plotter 
  134.      to the pen number designated by the argument.  
  135.      This is only available on the pen plotters and 
  136.      ink-jet printer.
  137.  
  138.  
  139.  
  140.      This  graphics  package  can be used on the Hewlett-Packard 7470A, the DEC
  141.  
  142. LVP16, the DEC LN03 laser printer, and the DEC  LCP01  color  ink-jet  printer.
  143.  
  144. The HP 7470A is a two pen plotter.  The DEC LVP16 is a six pen plotter.
  145.  
  146.      Columbia has several pen plotters available at 251 Engineering Terrace and
  147.  
  148. LN03s at both the Engineering Terrace and SIA terminal room.  The  use  of  the
  149.  
  150. plotters  requires your own plotter pens, which can be obtained in the Business
  151.  
  152. Office, and your own 8.5" by 11" or 11" by 17" paper.
  153.  
  154.  
  155.  
  156. 3. SAMPLE SESSION
  157.  
  158.      Below is an example program in the language C to put  a  round  peg  in  a
  159.  
  160. square  hole.  If you are not familiar with the C language you should be warned
  161.  
  162. that it is case sensitive and so if you  plan  to  try  running  the  following
  163.  
  164. program maintain the capitalization exactly.
  165.                                              /* This is a comment           */
  166. main()                                       /* Start of program            */
  167. {
  168.      openpl();                               /* Initialize plot routines    */
  169.  
  170.      move(10,10);                            /* Position cursor             */
  171.      label("Demo.");                         /* Text starts at cursor       */
  172.  
  173.      box(100,100,500,500);                   /* Draw a square hole          */
  174.      circle(300,300,200);                    /* Put the round peg in        */
  175.  
  176.      move(10,600);                           /* Position cursor             */
  177.      label("Done!");                         /* Some more text              */
  178.  
  179.      closepl();                              /* Close the plot routines     */
  180. }
  181.  
  182.  
  183.  
  184.      Note  that  the only C in the entire program was "main() { }" the rest was
  185.  
  186. entirely plot commands. C code could have been present, to calculate a sin wave
  187.  
  188. by points for example, but knowledge of C is not required to use plot.
  189.  
  190.      The  above code must be compiled before it will run. Assume that the above
  191.  
  192. C program is in a file named peg.c. The command to compile C  code  which  uses
  193.  
  194. plot commands is as follows:
  195.  
  196.  
  197.     cc -o peg peg.c -lplot
  198.  
  199.  
  200.      The  above  command  generates  the  program  peg  can be run at any time,
  201.  
  202. however it is still not producing output  for  any  specific  printing  device.
  203.  
  204. Suppose  that  you  were sitting at a Tektronics terminal and wanted to see the
  205.  
  206. demonstration right on the screen. The command to give would be:
  207.  
  208.  
  209.     peg | tek
  210.  
  211.  
  212.      The above command takes the generalized output from peg and  feeds  it  to
  213.  
  214. the  program  tek  which knows how to display graphics on a Tektronics terminal
  215.  
  216. (the "|" character is called a pipe in UNIX and must be  included).    The  tek
  217.  
  218. program then produces the graphics on your screen. The command:
  219.  
  220.  
  221.     peg | ln03 | lpr -Pmuddl1
  222.  
  223.  
  224.      Would  take the same generalized output from peg feed it to ln03 a program
  225.  
  226. which creates output for the DEC LN03 printer. Then ln03  program  would  feeds
  227.  
  228. its  output to the print command, lpr -Pmuddl1, which actually prints the given
  229.  
  230. output on the LN03 printer located in 251 Engineering Terrace.
  231.  
  232.      For further documentation look in sections 1,3 and 5 of  the  UNIX  manual
  233.  
  234. under  the  title  plot. On a UNIX machine these manual sections can be read by
  235.  
  236. saying:
  237. man 1 plot
  238. man 3 plot
  239. man 5 plot
  240.