--- ray/src/px/pfilt.c 1989/02/02 10:49:26 1.1 +++ ray/src/px/pfilt.c 1989/04/13 07:52:50 1.5 @@ -28,6 +28,9 @@ double rad = 0.0; /* output pixel radius for filteri int nrows = 0; /* number of rows for output */ int ncols = 0; /* number of columns for output */ +double x_c = 1.0; /* ratio of output x size to input */ +double y_r = 1.0; /* ratio of output y size to input */ + int singlepass = 0; /* true means skip first pass */ int avghot = 0; /* true means average in bright spots */ @@ -44,8 +47,6 @@ char *tfname = NULL; int xres, yres; /* resolution of input */ -double x_c, y_r; /* conversion factors */ - int xrad; /* x window size */ int yrad; /* y window size */ @@ -86,10 +87,20 @@ char **argv; if (argv[i][0] == '-') switch (argv[i][1]) { case 'x': - ncols = atoi(argv[++i]); + i++; + if (argv[i][0] == '/') { + x_c = 1.0/atof(argv[i]+1); + ncols = 0; + } else + ncols = atoi(argv[i]); break; case 'y': - nrows = atoi(argv[++i]); + i++; + if (argv[i][0] == '/') { + y_r = 1.0/atof(argv[i]+1); + nrows = 0; + } else + nrows = atoi(argv[i]); break; case 'e': if (argv[i+1][0] == '+' || argv[i+1][0] == '-') @@ -180,10 +191,14 @@ char **argv; fprintf(stderr, "%s: bad picture size\n", progname); quit(1); } - if (ncols <= 0) - ncols = xres; - if (nrows <= 0) - nrows = yres; + if (ncols > 0) + x_c = (double)ncols/xres; + else + ncols = x_c*xres + .5; + if (nrows > 0) + y_r = (double)nrows/yres; + else + nrows = y_r*yres + .5; if (singlepass) { /* skip exposure, etc. */ @@ -296,9 +311,6 @@ scan2init() /* prepare scanline arrays */ { double e; register int i; - - x_c = (double)ncols/xres; - y_r = (double)nrows/yres; if (rad <= 0.0) { xrad = xres/ncols/2 + 1;