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

Comparing ray/src/rt/virtuals.c (file contents):
Revision 1.17 by greg, Tue Jul 16 15:56:51 1991 UTC vs.
Revision 1.20 by greg, Fri Aug 2 10:30:27 1991 UTC

# Line 140 | Line 140 | MAT4  pm;
140                  ourspot.siz = PI*maxrad2;
141                  ourspot.flen = 0.;
142                  if (source[sn].sflags & SSPOT) {
143                        copystruct(&theirspot, source[sn].sl.s);
143                          multp3(theirspot.aim, source[sn].sl.s->aim, pm);
144 +                        d = sqrt(dist2(ourspot.aim, theirspot.aim));
145 +                        d = sqrt(source[sn].sl.s->siz/PI) + d*source[sn].ss;
146 +                        theirspot.siz = PI*d*d;
147 +                        ourspot.flen = theirspot.flen = source[sn].sl.s->flen;
148                          d = ourspot.siz;
149                          if (!commonbeam(&ourspot, &theirspot, nsloc))
150                                  return(-1);     /* no overlap */
# Line 164 | Line 167 | MAT4  pm;
167                  if (source[sn].sflags & SPROX && d > source[sn].sl.prox)
168                          return(-1);             /* too far away */
169                  ourspot.flen = 0.;
170 <                if (d*d > maxrad2)
171 <                        ourspot.siz = 2.*PI*(1. - sqrt(1.-maxrad2/(d*d)));
170 >                d = (sqrt(maxrad2) + source[sn].ss) / d;
171 >                if (d < 1.-FTINY)
172 >                        ourspot.siz = 2.*PI*(1. - sqrt(1.-d*d));
173                  else
174                          nsflags &= ~SSPOT;
175                  if (source[sn].sflags & SSPOT) {
# Line 195 | Line 199 | MAT4  pm;
199                  if (source[sn].sflags & SFLAT) {        /* behind source? */
200                          multv3(nsnorm, source[sn].snorm, pm);
201                          normalize(nsnorm);
202 <                        if (!checkspot(&ourspot, nsnorm))
202 >                        if (nsflags & SSPOT && !checkspot(&ourspot, nsnorm))
203                                  return(-1);
204                  }
205          }
# Line 287 | Line 291 | register int  sn;      /* target source number */
291          } else {
292                  for (i = 0; i < 3; i++)
293                          offsdir[i] = source[sn].sloc[i] - oc[i];
294 <                n = or2/DOT(offsdir,offsdir)*vspretest + .5;
294 >                d = DOT(offsdir,offsdir);
295 >                if (d <= FTINY)
296 >                        n = 2.*PI * vspretest + .5;
297 >                else
298 >                        n = 2.*PI * (1.-sqrt(1./(1.+or2/d)))*vspretest + .5;
299                  infront = DOT(onorm, offsdir) > 0.;
300          }
301          if (n < MINSAMPLES) n = MINSAMPLES;
# Line 338 | Line 346 | register int  sn;      /* target source number */
346                          continue;
347                  nok++;
348                                          /* check against obstructions */
349 <                srcray(&sr, NULL, sn);
349 >                rayclear(&sr);
350 >                sr.revf = raytrace;
351                  rayvalue(&sr);
352                  if (bright(sr.rcol) > FTINY)
353                          nhit++;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines