1*48502Sbostic /*- 2*48502Sbostic * Copyright (c) 1983 The Regents of the University of California. 3*48502Sbostic * All rights reserved. 4*48502Sbostic * 5*48502Sbostic * %sccs.include.proprietary.c% 6*48502Sbostic */ 7*48502Sbostic 815525Sralph #ifndef lint 9*48502Sbostic static char sccsid[] = "@(#)space.c 5.2 (Berkeley) 04/22/91"; 10*48502Sbostic #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 */ 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