--- ray/src/px/pinterp.c 1996/06/24 09:17:47 2.28 +++ ray/src/px/pinterp.c 1999/07/16 16:11:31 2.32 @@ -1,7 +1,7 @@ -/* Copyright (c) 1995 Regents of the University of California */ +/* Copyright (c) 1999 Silicon Graphics, Inc. */ #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static char SCCSid[] = "$SunId$ SGI"; #endif /* @@ -39,7 +39,7 @@ static char SCCSid[] = "$SunId$ LBL"; #define PACKSIZ 256 /* max. calculation packet size */ -#define RTCOM "rtrace -h- -ovl -fff " +#define RTCOM "rtrace -h- -ovl -fff -ld- -i- -I- " #define ABS(x) ((x)>0?(x):-(x)) @@ -328,20 +328,21 @@ userr: } +int headline(s) /* process header string */ char *s; { char fmt[32]; if (isheadid(s)) - return; + return(0); if (formatval(fmt, s)) { if (globmatch(ourfmt, fmt)) { wrongformat = 0; strcpy(ourfmt, fmt); } else wrongformat = 1; - return; + return(0); } if (nvavg < 2) { putc('\t', stdout); @@ -349,10 +350,11 @@ char *s; } if (isexpos(s)) { theirexp *= exposval(s); - return; + return(0); } if (isview(s) && sscanview(&theirview, s) > 0) gotview++; + return(0); } @@ -672,7 +674,6 @@ register FVECT pos; { FVECT pt, tdir, odir; double d; - register int i; if (pos[2] <= 0) /* empty pixel */ return(0); @@ -717,15 +718,18 @@ register FVECT pos; return(0); if (!averaging) return(1); - if (ourview.type == VT_PAR) /* compute our direction */ - VCOPY(odir, ourview.vdir); - else - for (i = 0; i < 3; i++) - odir[i] = (pt[i] - ourview.vp[i])/pos[2]; - d = DOT(odir,tdir); /* compute pixel weight */ - if (d >= 1.-1./MAXWT/MAXWT) + /* compute pixel weight */ + if (ourview.type == VT_PAR) { + d = DOT(ourview.vdir,tdir); + d = 1. - d*d; + } else { + VSUB(odir, pt, ourview.vp); + d = DOT(odir,tdir); + d = 1. - d*d/DOT(odir,odir); + } + if (d <= 1./MAXWT/MAXWT) return(MAXWT); /* clip to maximum weight */ - return(1./sqrt(1.-d)); + return(1./sqrt(d)); } @@ -1169,9 +1173,9 @@ clearqueue() /* process queue */ } /* mark end and get results */ bzero((char *)fbp, 6*sizeof(float)); - if (process(PDesc, fbuf, fbuf, 4*sizeof(float)*queuesiz, + if (process(PDesc, fbuf, fbuf, 4*sizeof(float)*(queuesiz+1), 6*sizeof(float)*(queuesiz+1)) != - 4*sizeof(float)*queuesiz) { + 4*sizeof(float)*(queuesiz+1)) { fprintf(stderr, "%s: error reading from rtrace process\n", progname); exit(1);