ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pcond4.c
(Generate patch)

Comparing ray/src/px/pcond4.c (file contents):
Revision 3.3 by greg, Fri Oct 4 16:10:43 1996 UTC vs.
Revision 3.6 by greg, Sat Oct 5 08:05:27 1996 UTC

# Line 99 | Line 99 | compveil()                             /* compute veiling image */
99                                          t2 = DOT(rdirscan(py)[px],
100                                                          rdirscan(y)[x]);
101                                          if (t2 <= FTINY) continue;
102 +                                        /*      use approximation instead
103                                          t2 = acos(t2);
104                                          t2 = 1./(t2*t2);
105 +                                        */
106 +                                        t2 = .5 / (1. - t2);
107                                          copycolor(ctmp, fovscan(y)[x]);
108                                          scalecolor(ctmp, t2);
109                                          addcolor(vsum, ctmp);
# Line 177 | Line 180 | double La;
180          };
181          double  l10La;
182          register int    i;
183 <                                        /* interpolate/extrapolate data */
183 >                                        /* check limits */
184 >        if (La <= 7.85e-4)
185 >                return(resfreq[0]);
186 >        if (La >= 1.78e3)
187 >                return(resfreq[NPOINTS-1]);
188 >                                        /* interpolate data */
189          l10La = log10(La);
190          for (i = 0; i < NPOINTS-2 && l10lum[i+1] <= l10La; i++)
191                  ;
# Line 196 | Line 204 | int    y;
204          register COLOR  *sl0, *sl1, *mysl;
205          register int    i;
206  
207 <        if (y < sb->nread - sb->nscans) {
208 <                fprintf(stderr, "%s: internal - cannot backspace in getascan\n",
201 <                                progname);
202 <                exit(1);
203 <        }
207 >        if (y < sb->nread - sb->nscans)                 /* too far back? */
208 >                return(NULL);
209          for ( ; y >= sb->nread; sb->nread++) {          /* read as necessary */
210                  mysl = bscan(sb, sb->nread);
211                  if (sb->sampr == 1) {
# Line 211 | Line 216 | int    y;
216                          }
217                  } else {
218                          sl0 = getascan(sb->next, 2*y);
219 +                        if (sl0 == NULL)
220 +                                return(NULL);
221                          sl1 = getascan(sb->next, 2*y+1);
222                          for (i = 0; i < sb->len; i++) {
223                                  copycolor(mysl[i], sl0[2*i]);
# Line 283 | Line 290 | SCANBAR        *sb;
290          double  dx, dy;
291          int     ix, iy;
292  
293 +        if (sb->sampr == 1) {           /* no need to interpolate */
294 +                sl0 = getascan(sb, y);
295 +                copycolor(col, sl0[x]);
296 +                return;
297 +        }
298 +                                        /* compute coordinates for sb */
299          ix = dx = (x+.5)/sb->sampr - .5;
300          if (ix >= sb->len-1) ix--;
301          dx -= (double)ix;
# Line 291 | Line 304 | SCANBAR        *sb;
304          dy -= (double)iy;
305                                          /* get scanlines */
306          sl0 = getascan(sb, iy);
307 +        if (sl0 == NULL) {
308 +                fprintf(stderr, "%s: internal - cannot backspace in ascanval\n",
309 +                                progname);
310 +                exit(1);
311 +        }
312          sl1 = getascan(sb, iy+1);
313                                          /* 2D linear interpolation */
314          copycolor(col, sl0[ix]);
# Line 355 | Line 373 | initacuity()                   /* initialize variable acuity sampling
373                          }
374                          fcross(cp, diffx, diffy);
375                          omega = 0.5 * sqrt(DOT(cp,cp));
376 <                        tsampr(x,y) = PI/180. / sqrt(omega) /
377 <                                        hacuity(plum(fovscan(y)[x]));
378 <                        if (tsampr(x,y) > maxsr)
376 >                        if (omega <= FTINY)
377 >                                tsampr(x,y) = 1.;
378 >                        else if ((tsampr(x,y) = PI/180. / sqrt(omega) /
379 >                                        hacuity(plum(fovscan(y)[x]))) > maxsr)
380                                  maxsr = tsampr(x,y);
381                  }
382                                          /* copy perimeter (easier) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines