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

Comparing ray/src/px/pf3.c (file contents):
Revision 2.4 by greg, Thu Nov 12 11:35:55 1992 UTC vs.
Revision 2.5 by greg, Fri Jun 18 13:36:20 1993 UTC

# Line 38 | Line 38 | extern COLOR  *scanout;                /* output scan line */
38  
39   extern char  *progname;
40  
41 < float  *exptable;               /* exponent table */
41 > float  *gausstable;             /* gauss lookup table */
42  
43 < #define  lookexp(x)             exptable[(int)(-10.*(x)+.5)]
43 > #define  lookgauss(x)           gausstable[(int)(-10.*(x)+.5)]
44  
45  
46   initmask()                      /* initialize gaussian lookup table */
47   {
48          extern char  *malloc();
49 +        double  d;
50          register int  x;
51  
52 <        exptable = (float *)malloc(100*sizeof(float));
53 <        if (exptable == NULL) {
52 >        gausstable = (float *)malloc(100*sizeof(float));
53 >        if (gausstable == NULL) {
54                  fprintf(stderr, "%s: out of memory in initmask\n", progname);
55                  quit(1);
56          }
57 <        for (x = 0; x < 100; x++)
58 <                exptable[x] = exp(-x*0.1);
57 >        d = x_c*y_r*0.25/rad/rad;
58 >        gausstable[0] = exp(-d)/sqrt(d);
59 >        for (x = 1; x < 100; x++)
60 >                if ((gausstable[x] = exp(-x*0.1)/sqrt(x*0.1)) > gausstable[0])
61 >                        gausstable[x] = gausstable[0];
62   }
63  
64  
# Line 115 | Line 119 | int  c, r;
119                          if (x < 0) continue;
120                          if (x >= xres) break;
121                          dx = (x_c*(x+.5) - (c+.5))/rad;
122 <                        weight = lookexp(-(dx*dx + dy*dy));
122 >                        weight = lookgauss(-(dx*dx + dy*dy));
123                          wsum += weight;
124                          copycolor(ctmp, scan[x]);
125                          scalecolor(ctmp, weight);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines