xref: /csrg-svn/lib/libplot/aed/space.c (revision 15525)
1*15525Sralph #ifndef lint
2*15525Sralph static char sccsid[] = "@(#)space.c	4.1 (Berkeley) 11/11/83";
3*15525Sralph #endif
4*15525Sralph 
5*15525Sralph #include "aed.h"
6*15525Sralph 
7*15525Sralph /*---------------------------------------------------------
8*15525Sralph  *	Space sets up the world-to-screen transformation so
9*15525Sralph  *	that the rectangular area described by (x0, y0) and
10*15525Sralph  *	(x1, y1) will all be on-screen.
11*15525Sralph  *
12*15525Sralph  *	Results:	None.
13*15525Sralph  *
14*15525Sralph  *	Side Effects:
15*15525Sralph  *	Our own variables scale, xbot, and ybot are changed.
16*15525Sralph  *---------------------------------------------------------
17*15525Sralph  */
18*15525Sralph space(x0, y0, x1, y1)
19*15525Sralph int x0, y0, x1, y1;
20*15525Sralph {
21*15525Sralph     int xscale, yscale, xsize, ysize;
22*15525Sralph     xscale = (GRXMAX<<12)/(x1-x0);
23*15525Sralph     yscale = (GRYMAX<<12)/(y1-y0);
24*15525Sralph     if (xscale > yscale) scale = yscale;
25*15525Sralph     else scale = xscale;
26*15525Sralph     scale = (scale*9)/10 - 1;
27*15525Sralph     if (scale<1) scale = 1;
28*15525Sralph     xsize = (2048*GRXMAX)/scale + 1;
29*15525Sralph     xbot = (x1+x0)/2 - xsize;
30*15525Sralph     ysize = (2048*GRYMAX)/scale + 1;
31*15525Sralph     ybot = (y1+y0)/2 - ysize;
32*15525Sralph }
33