home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / graphics.17 / graphics / graphics-0.17 / plot2tek / space.c < prev   
Encoding:
C/C++ Source or Header  |  1991-03-21  |  1.4 KB  |  40 lines

  1. /* This file is the space routine, which is a standard part of the plot
  2.    library.  It sets the lower left and upper right corners of the page.  The
  3.    plot will be scaled so that these coners fit the largest renderable area on
  4.    the page.  */
  5.  
  6. #include "sys-defines.h"
  7. #include "libplot.h"
  8.  
  9. int
  10. space (x0, y0, x1, y1)
  11.      int x0, y0, x1, y1;
  12. {
  13.   double x_scale, y_scale;
  14.   x_input_min = x0;
  15.   y_input_min = y0;
  16.   x_scale = (x1 - x0)/(x_output_max - x_output_min);
  17.   y_scale = (y1 - y0)/(y_output_max - y_output_min);
  18.   if (x_scale > y_scale)
  19.     scaleup = x_scale;
  20.   else
  21.     scaleup = y_scale;
  22.   return 0;
  23. }
  24.  
  25. /* libtek, a library of functions for tektronics 4010 compatible devices.
  26.    Copyright (C) 1989 Free Software Foundation, Inc.
  27.  
  28. libtek is distributed in the hope that it will be useful, but WITHOUT ANY
  29. WARRANTY.  No author or distributor accepts responsibility to anyone for the
  30. consequences of using it or for whether it serves any particular purpose or
  31. works at all, unless he says so in writing.  Refer to the GNU General Public
  32. License for full details.
  33.  
  34. Everyone is granted permission to copy, modify and redistribute libtek, but
  35. only under the conditions described in the GNU General Public License.  A copy
  36. of this license is supposed to have been given to you along with libtek so
  37. you can know your rights and responsibilities.  It should be in a file named
  38. COPYING.  Among other things, the copyright notice and this notice must be
  39. preserved on all copies.  */
  40.