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.3 by greg, Tue Jul 21 12:47:12 1992 UTC vs.
Revision 2.6 by greg, Wed Jul 20 12:48:44 1994 UTC

# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #include  "random.h"
16  
17  
18 + static int  cyl_partit(), flt_partit();
19 +
20 +
21   double
22   nextssamp(r, si)                /* compute sample for source, rtn. distance */
23   register RAY  *r;               /* origin is read, direction is set */
# Line 79 | Line 82 | nextsample:
82                  goto nextsample;                /* at source! */
83  
84                                          /* compute sample size */
82        si->dom  = source[si->sn].ss2;
85          if (source[si->sn].sflags & SFLAT) {
86 <                si->dom *= sflatform(si->sn, r->rdir);
87 <                si->dom *= (double)(size[SU]*size[SV])/(MAXSPART*MAXSPART);
86 >                si->dom = sflatform(si->sn, r->rdir);
87 >                si->dom *= size[SU]*size[SV]/(MAXSPART*(double)MAXSPART);
88          } else if (source[si->sn].sflags & SCYL) {
89 <                si->dom *= scylform(si->sn, r->rdir);
90 <                si->dom *= (double)size[SU]/MAXSPART;
89 >                si->dom = scylform(si->sn, r->rdir);
90 >                si->dom *= size[SU]/(double)MAXSPART;
91          } else {
92 <                si->dom *= (double)(size[SU]*size[SV]*size[SW]) /
93 <                                (MAXSPART*MAXSPART*MAXSPART) ;
92 >                si->dom = size[SU]*size[SV]*(double)size[SW] /
93 >                                (MAXSPART*MAXSPART*(double)MAXSPART) ;
94          }
95 <        if (source[si->sn].sflags & SDISTANT)
95 >        if (source[si->sn].sflags & SDISTANT) {
96 >                si->dom *= source[si->sn].ss2;
97                  return(FHUGE);
98 +        }
99          if (si->dom <= 1e-4)
100                  goto nextsample;                /* behind source? */
101 <        si->dom /= d*d;
101 >        si->dom *= source[si->sn].ss2/(d*d);
102          return(d);              /* sample OK, return distance */
103   }
104  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines