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

Comparing ray/src/cv/mgflib/context.c (file contents):
Revision 1.19 by greg, Mon Mar 13 13:00:34 1995 UTC vs.
Revision 1.20 by greg, Wed Apr 12 17:16:33 1995 UTC

# Line 554 | Line 554 | char   **av;
554          int     n, imax;
555          int     wl;
556          double  wl0, wlstep;
557 +        double  boxpos, boxstep;
558                                          /* check bounds */
559          if (wlmax <= C_CMINWL | wlmax <= wlmin | wlmin >= C_CMAXWL)
560                  return(MG_EILL);
# Line 566 | Line 567 | char   **av;
567                  wlmax -= wlstep;
568                  ac--;
569          }
569        if (ac < 2)
570                return(MG_EILL);
570          imax = ac;                      /* box filter if necessary */
571 +        boxpos = 0;
572 +        boxstep = 1;
573          if (wlstep < C_CWLI) {
574 +                imax = (wlmax - wlmin)/C_CWLI + (1-FTINY);
575 +                boxpos = (wlmin - C_CMINWL)/C_CWLI;
576 +                boxstep = wlstep/C_CWLI;
577                  wlstep = C_CWLI;
574                imax = (wlmax - wlmin)/wlstep;
578          }
579          scale = 0.;                     /* get values and maximum */
580          pos = 0;
581          for (i = 0; i < imax; i++) {
582                  va[i] = 0.; n = 0;
583 <                while (pos < (i+.5)*ac/imax) {
583 >                while (boxpos < i+.5 && pos < ac) {
584                          if (!isflt(av[pos]))
585                                  return(MG_ETYPE);
586                          va[i] += atof(av[pos++]);
587                          n++;
588 +                        boxpos += boxstep;
589                  }
590                  if (n > 1)
591                          va[i] /= (double)n;
# Line 590 | Line 594 | char   **av;
594                  if (va[i] > scale)
595                          scale = va[i];
596          }
597 <        if (scale == 0.)
597 >        if (scale <= FTINY)
598                  return(MG_EILL);
599          scale = C_CMAXV / scale;
600          clr->ssum = 0;                  /* convert to our spacing */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines