148511Sbostic /*-
2*61391Sbostic * Copyright (c) 1980, 1986, 1993
3*61391Sbostic * The Regents of the University of California. All rights reserved.
448511Sbostic *
548511Sbostic * %sccs.include.proprietary.c%
629816Ssklower */
729816Ssklower
829816Ssklower #ifndef lint
9*61391Sbostic static char sccsid[] = "@(#)space.c 8.1 (Berkeley) 06/04/93";
1048511Sbostic #endif /* not lint */
1129816Ssklower
1229816Ssklower #include "grnplot.h"
1329816Ssklower
1429816Ssklower /*---------------------------------------------------------
1529816Ssklower * Space sets up the world-to-screen transformation so
1629816Ssklower * that the rectangular area described by (x0, y0) and
1729816Ssklower * (x1, y1) will all be on-screen.
1829816Ssklower *
1929816Ssklower * Results: None.
2029816Ssklower *
2129816Ssklower * Side Effects:
2229816Ssklower * Our own variables scale, xbot, and ybot are changed.
2329816Ssklower *---------------------------------------------------------
2429816Ssklower */
space(x0,y0,x1,y1)2529816Ssklower space(x0, y0, x1, y1)
2629816Ssklower int x0, y0, x1, y1;
2729816Ssklower {
2829816Ssklower double xscale=0.0, yscale=0.0;
2929816Ssklower if (x1>x0)
3029816Ssklower xscale = GRXMAX/(double)(x1-x0);
3129816Ssklower if (y1>y0)
3229816Ssklower yscale = GRYMAX/(double)(y1-y0);
3329816Ssklower scale = (xscale > yscale && yscale > 0)? yscale : xscale;
3429816Ssklower if (scale == 0.0) scale == 1.0;
3529816Ssklower xbot = x0;
3629816Ssklower ybot = y0;
3729816Ssklower }
38