--- ray/src/px/pfilt.c 1995/10/16 12:04:36 2.15 +++ ray/src/px/pfilt.c 1996/04/01 17:24:44 2.17 @@ -1,4 +1,4 @@ -/* Copyright (c) 1992 Regents of the University of California */ +/* Copyright (c) 1996 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -17,6 +17,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include "color.h" +#include "view.h" + #include "resolu.h" #include "paths.h" @@ -64,6 +66,10 @@ int correctaspect = 0; /* aspect ratio correction? * int wrongformat = 0; +VIEW ourview = STDVIEW; +int gotview = 0; +int wrapfilt = 0; /* wrap filter horizontally? */ + int xrad; /* x search radius */ int yrad; /* y search radius */ int xbrad; /* x box size */ @@ -267,6 +273,9 @@ char **argv; } if (!(order & YMAJOR)) inpaspect = 1.0/inpaspect; + /* wrap around for cylindrical view? */ + wrapfilt = gotview && ourview.type == VT_CYL && + ourview.horiz >= 360.-FTINY && order & YMAJOR; /* compute output resolution */ if (ncols <= 0) ncols = x_c*xres + .5; @@ -339,7 +348,8 @@ char *s; ourbright = xyz_bright; else wrongformat = !globmatch(PICFMT, fmt); - } + } else if (isview(s) && sscanview(&ourview, s) > 0) + gotview++; } @@ -454,9 +464,9 @@ scan2init() /* prepare scanline arrays */ rad *= (y_r + x_c)/2.0; if (thresh > FTINY) { - xrad = CHECKRAD*THRESHRAD*rad/x_c + xbrad; - yrad = CHECKRAD*THRESHRAD*rad/y_r + ybrad; orad = CHECKRAD*THRESHRAD*rad + 1; + xrad = orad/x_c + xbrad; + yrad = orad/y_r + ybrad; obarsize = 2*orad + 1; } else { xrad = CHECKRAD*rad/x_c + 1; @@ -526,7 +536,7 @@ int r; int ybot; register int c; /* average input scanlines */ - while (nextrow < r+orad && nextrow < nrows) { + while (nextrow <= r+orad && nextrow < nrows) { ybot = (long)nextrow*yres/nrows; for (c = 0; c < ncols; c++) { dobox(ctmp, (int)((long)c*xres/ncols),ybot, c,nextrow);