148502Sbostic /*-
2*61327Sbostic * Copyright (c) 1983, 1993
3*61327Sbostic * The Regents of the University of California. All rights reserved.
448502Sbostic *
548502Sbostic * %sccs.include.proprietary.c%
648502Sbostic */
748502Sbostic
815525Sralph #ifndef lint
9*61327Sbostic static char sccsid[] = "@(#)space.c 8.1 (Berkeley) 06/04/93";
1048502Sbostic #endif /* not lint */
1115525Sralph
1215525Sralph #include "aed.h"
1315525Sralph
1415525Sralph /*---------------------------------------------------------
1515525Sralph * Space sets up the world-to-screen transformation so
1615525Sralph * that the rectangular area described by (x0, y0) and
1715525Sralph * (x1, y1) will all be on-screen.
1815525Sralph *
1915525Sralph * Results: None.
2015525Sralph *
2115525Sralph * Side Effects:
2215525Sralph * Our own variables scale, xbot, and ybot are changed.
2315525Sralph *---------------------------------------------------------
2415525Sralph */
space(x0,y0,x1,y1)2515525Sralph space(x0, y0, x1, y1)
2615525Sralph int x0, y0, x1, y1;
2715525Sralph {
2815525Sralph int xscale, yscale, xsize, ysize;
2915525Sralph xscale = (GRXMAX<<12)/(x1-x0);
3015525Sralph yscale = (GRYMAX<<12)/(y1-y0);
3115525Sralph if (xscale > yscale) scale = yscale;
3215525Sralph else scale = xscale;
3315525Sralph scale = (scale*9)/10 - 1;
3415525Sralph if (scale<1) scale = 1;
3515525Sralph xsize = (2048*GRXMAX)/scale + 1;
3615525Sralph xbot = (x1+x0)/2 - xsize;
3715525Sralph ysize = (2048*GRYMAX)/scale + 1;
3815525Sralph ybot = (y1+y0)/2 - ysize;
3915525Sralph }
40