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

Comparing ray/src/rt/srcsamp.c (file contents):
Revision 2.12 by greg, Sat Dec 6 01:08:53 2008 UTC vs.
Revision 2.15 by greg, Wed Dec 10 17:33:23 2008 UTC

# Line 69 | Line 69 | nextsample:
69          for (i = 0; i < 3; i++)
70                  vpos[i] += (double)cent[i]/MAXSPART;
71                                          /* avoid circular aiming failures */
72 <        if (source[si->sn].sflags & SCIR) {
72 >        if ((source[si->sn].sflags & SCIR) && (si->np > 1 || dstrsrc > 0.7)) {
73                  FVECT   trim;
74                double  d;
74                  if (source[si->sn].sflags & (SFLAT|SDISTANT)) {
75                          d = 1.12837917;         /* correct setflatss() */
76                          trim[SU] = d*sqrt(1.0 - 0.5*vpos[SV]*vpos[SV]);
# Line 85 | Line 84 | nextsample:
84                          d = vpos[SW]*vpos[SW];
85                          if (d > trim[SW]) trim[SW] = d;
86                          trim[SU] += d;
87 <                        d = 1.0/0.7236;         /* correct sphsetsrc() */
88 <                        trim[SW] = trim[SV] = trim[SU] =
89 <                                        d*sqrt(trim[SW]/trim[SU]);
87 >                        if (trim[SU] > FTINY*FTINY) {
88 >                                d = 1.0/0.7236; /* correct sphsetsrc() */
89 >                                trim[SW] = trim[SV] = trim[SU] =
90 >                                                d*sqrt(trim[SW]/trim[SU]);
91 >                        } else
92 >                                trim[SW] = trim[SV] = trim[SU] = 0.0;
93                  }
94                  for (i = 0; i < 3; i++)
95                          vpos[i] *= trim[i];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines