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