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

Comparing ray/src/px/pinterp.c (file contents):
Revision 1.6 by greg, Thu Dec 28 15:09:28 1989 UTC vs.
Revision 1.7 by greg, Tue Jan 2 17:22:07 1990 UTC

# Line 296 | Line 296 | float  *zline;
296                  }
297                  pos[0] += .5*ourview.hresolu;
298                  pos[1] += .5*ourview.vresolu;
299 <                if (pos[0] < 0 || pos[0] > ourview.hresolu
300 <                                || pos[1] < 0 || pos[1] > ourview.vresolu)
299 >                if (pos[0] < 0 || pos[0] >= ourview.hresolu
300 >                                || pos[1] < 0 || pos[1] >= ourview.vresolu)
301                          continue;
302                                          /* check current value at pos */
303                  xpos = pos[0];
# Line 326 | Line 326 | fillpicture()                          /* fill in empty spaces */
326          }
327          for (x = 0; x < ourview.hresolu; x++)
328                  yback[x] = -2;
329 +        /*
330 +         * Xback and yback are the pixel locations of suitable
331 +         * background values in each direction.
332 +         * A value of -2 means unassigned, and -1 means
333 +         * that there is no suitable background in this direction.
334 +         */
335                                                          /* fill image */
336          for (y = 0; y < ourview.vresolu; y++) {
337                  xback = -2;
338                  for (x = 0; x < ourview.hresolu; x++)
339                          if (zscan(y)[x] <= 0.0) {       /* empty pixel */
340 +                                /*
341 +                                 * First, find background from above or below.
342 +                                 * (farthest assigned pixel)
343 +                                 */
344                                  if (yback[x] == -2) {
345                                          for (i = y+1; i < ourview.vresolu; i++)
346                                                  if (zscan(i)[x] > 0.0)
# Line 341 | Line 351 | fillpicture()                          /* fill in empty spaces */
351                                          else
352                                                  yback[x] = y-1;
353                                  }
354 +                                /*
355 +                                 * Next, find background from left or right.
356 +                                 */
357                                  if (xback == -2) {
358                                          for (i = x+1; x < ourview.hresolu; i++)
359                                                  if (zscan(y)[i] > 0.0)
# Line 352 | Line 365 | fillpicture()                          /* fill in empty spaces */
365                                                  xback = x-1;
366                                  }
367                                  if (xback < 0 && yback[x] < 0)
368 <                                        continue;
368 >                                        continue;       /* no background */
369 >                                /*
370 >                                 * Compare, and use the background that is
371 >                                 * farther, unless one of them is next to us.
372 >                                 */
373                                  if (yback[x] < 0 || ABS(x-xback) <= 1
374                                          || ( ABS(y-yback[x]) > 1
375                                  && zscan(yback[x])[x] < zscan(y)[xback] ))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines