1 /*- 2 * Copyright (c) 1980, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)space.c 8.1 (Berkeley) 06/04/93"; 10 #endif /* not lint */ 11 12 #include "grnplot.h" 13 14 /*--------------------------------------------------------- 15 * Space sets up the world-to-screen transformation so 16 * that the rectangular area described by (x0, y0) and 17 * (x1, y1) will all be on-screen. 18 * 19 * Results: None. 20 * 21 * Side Effects: 22 * Our own variables scale, xbot, and ybot are changed. 23 *--------------------------------------------------------- 24 */ 25 space(x0, y0, x1, y1) 26 int x0, y0, x1, y1; 27 { 28 double xscale=0.0, yscale=0.0; 29 if (x1>x0) 30 xscale = GRXMAX/(double)(x1-x0); 31 if (y1>y0) 32 yscale = GRYMAX/(double)(y1-y0); 33 scale = (xscale > yscale && yscale > 0)? yscale : xscale; 34 if (scale == 0.0) scale == 1.0; 35 xbot = x0; 36 ybot = y0; 37 } 38