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.2 by greg, Mon Sep 21 12:14:12 1992 UTC vs.
Revision 2.4 by greg, Thu Nov 12 11:35:55 1992 UTC

# Line 12 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12  
13   #include  <stdio.h>
14  
15 + #include  <math.h>
16 +
17   #include  "color.h"
18  
19   #define  FTINY          1e-7
# Line 44 | Line 46 | float  *exptable;              /* exponent table */
46   initmask()                      /* initialize gaussian lookup table */
47   {
48          extern char  *malloc();
47        extern double  exp();
49          register int  x;
50  
51          exptable = (float *)malloc(100*sizeof(float));
# Line 71 | Line 72 | int  c, r;
72          wsum = 0;
73          setcolor(csum, 0.0, 0.0, 0.0);
74          for (y = ycent+1-yrad; y <= ycent+yrad; y++) {
75 <                if (y < 0 || y >= yres)
76 <                        continue;
77 <                d = y_r < 1.0 ? y_r*y - r : y - ycent;
75 >                if (y < 0) continue;
76 >                if (y >= yres) break;
77 >                d = y_r < 1.0 ? y_r*y - r : (double)(y - ycent);
78                  if (d > 0.5+FTINY || d < -0.5-FTINY)
79                          continue;
80                  scan = scanin[y%barsize];
81                  for (x = xcent+1-xrad; x <= xcent+xrad; x++) {
82 <                        if (x < 0 || x >= xres)
83 <                                continue;
84 <                        d = x_c < 1.0 ? x_c*x - c : x - xcent;
82 >                        if (x < 0) continue;
83 >                        if (x >= xres) break;
84 >                        d = x_c < 1.0 ? x_c*x - c : (double)(x - xcent);
85                          if (d > 0.5+FTINY || d < -0.5-FTINY)
86                                  continue;
87                          wsum++;
# Line 106 | Line 107 | int  c, r;
107          wsum = FTINY;
108          setcolor(csum, 0.0, 0.0, 0.0);
109          for (y = ycent-yrad; y <= ycent+yrad; y++) {
110 <                if (y < 0 || y >= yres)
111 <                        continue;
110 >                if (y < 0) continue;
111 >                if (y >= yres) break;
112                  dy = (y_r*(y+.5) - (r+.5))/rad;
113                  scan = scanin[y%barsize];
114                  for (x = xcent-xrad; x <= xcent+xrad; x++) {
115 <                        if (x < 0 || x >= xres)
116 <                                continue;
115 >                        if (x < 0) continue;
116 >                        if (x >= xres) break;
117                          dx = (x_c*(x+.5) - (c+.5))/rad;
118                          weight = lookexp(-(dx*dx + dy*dy));
119                          wsum += weight;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines