|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980, 1986 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: */ ! 6: ! 7: #ifndef lint ! 8: static char sccsid[] = "@(#)space.c 6.1 (Berkeley) 8/29/86"; ! 9: #endif not lint ! 10: ! 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: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.