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