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

Comparing ray/src/util/glaresrc.c (file contents):
Revision 1.8 by greg, Wed Mar 20 13:32:56 1991 UTC vs.
Revision 1.10 by greg, Thu Mar 21 17:11:50 1991 UTC

# Line 92 | Line 92 | double br;
92          register int    i;
93  
94          if (h <= -hlim) {                       /* left region */
95 <                d = (double)(h+hlim)/sampdens;
96 <                if (d <= -1.0+FTINY)
95 >                d = (double)(-h-hlim)/sampdens;
96 >                if (d >= 1.0-FTINY)
97                          return;
98                  tanb = d/sqrt(1.0-d*d);
99                  for (i = 0; i < nglardirs; i++) {
100                          d = indirect[i].lcos - tanb*indirect[i].lsin;
101                          if (d > 0.0) {
102                                  indirect[i].sum += d * br;
103 <                                indirect[i].n++;
103 >                                indirect[i].n += d;
104                          }
105                  }
106                  return;
107          }
108          if (h >= hlim) {                        /* right region */
109 <                d = (double)(h-hlim)/sampdens;
110 <                if (d >= 1.0-FTINY)
109 >                d = (double)(-h+hlim)/sampdens;
110 >                if (d <= -1.0+FTINY)
111                          return;
112                  tanb = d/sqrt(1.0-d*d);
113                  for (i = 0; i < nglardirs; i++) {
114                          d = indirect[i].rcos - tanb*indirect[i].rsin;
115                          if (d > 0.0) {
116                                  indirect[i].sum += d * br;
117 <                                indirect[i].n++;
117 >                                indirect[i].n += d;
118                          }
119                  }
120                  return;
# Line 124 | Line 124 | double br;
124                  d = cos(h_theta(h) - indirect[i].theta);
125                  if (d > 0.0) {
126                          indirect[i].sum += d * br;
127 <                        indirect[i].n++;
127 >                        indirect[i].n += d;
128                  }
129          }
130   }
# Line 359 | Line 359 | absorb(s)                      /* absorb a source into indirect */
359   register struct source  *s;
360   {
361          FVECT   dir;
362 <        register int    i, n;
362 >        double  d;
363 >        register int    i;
364  
365          for (i = 0; i < nglardirs; i++) {
366                  spinvector(dir, ourview.vdir, ourview.vup, indirect[i].theta);
367 <                n = DOT(dir,s->dir)*s->dom*(sampdens*sampdens) + 0.5;
368 <                if (n == 0)
367 >                d = DOT(dir,s->dir)*s->dom*(sampdens*sampdens);
368 >                if (d <= 0.0)
369                          continue;
370 <                indirect[i].sum += n * s->brt;
371 <                indirect[i].n += n;
370 >                indirect[i].sum += d * s->brt;
371 >                indirect[i].n += d;
372          }
373          for ( ; s->first != NULL; s->first = s->first->next)
374                  free((char *)s->first);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines