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.16 by greg, Sat Jun 6 02:11:44 2009 UTC vs.
Revision 2.17 by greg, Sat Oct 23 18:13:54 2010 UTC

# Line 64 | Line 64 | nextsample:
64                          multisamp(vpos, 3, d);
65                  for (i = 0; i < 3; i++)
66                          vpos[i] = dstrsrc * (1. - 2.*vpos[i]) *
67 <                                        (double)size[i]/MAXSPART;
67 >                                        (double)size[i]*(1.0/MAXSPART);
68          } else
69                  vpos[0] = vpos[1] = vpos[2] = 0.0;
70  
71 <        for (i = 0; i < 3; i++)
72 <                vpos[i] += (double)cent[i]/MAXSPART;
71 >        VSUM(vpos, vpos, cent, 1.0/MAXSPART);
72                                          /* avoid circular aiming failures */
73          if ((srcp->sflags & SCIR) && (si->np > 1 || dstrsrc > 0.7)) {
74                  FVECT   trim;
# Line 104 | Line 103 | nextsample:
103                                  vpos[SW]*srcp->ss[SW][i];
104  
105          if (!(srcp->sflags & SDISTANT))
106 <                for (i = 0; i < 3; i++)
108 <                        r->rdir[i] -= r->rorg[i];
106 >                VSUB(r->rdir, r->rdir, r->rorg);
107                                          /* compute distance */
108          if ((d = normalize(r->rdir)) == 0.0)
109                  goto nextsample;                /* at source! */
# Line 113 | Line 111 | nextsample:
111                                          /* compute sample size */
112          if (srcp->sflags & SFLAT) {
113                  si->dom = sflatform(si->sn, r->rdir);
114 <                si->dom *= size[SU]*size[SV]/(MAXSPART*(double)MAXSPART);
114 >                si->dom *= size[SU]*size[SV]*(1.0/MAXSPART/MAXSPART);
115          } else if (srcp->sflags & SCYL) {
116                  si->dom = scylform(si->sn, r->rdir);
117 <                si->dom *= size[SU]/(double)MAXSPART;
117 >                si->dom *= size[SU]*(1.0/MAXSPART);
118          } else {
119 <                si->dom = size[SU]*size[SV]*(double)size[SW] /
120 <                                (MAXSPART*MAXSPART*(double)MAXSPART) ;
119 >                si->dom = size[SU]*size[SV]*(double)size[SW] *
120 >                                (1.0/MAXSPART/MAXSPART/MAXSPART) ;
121          }
122          if (srcp->sflags & SDISTANT) {
123                  si->dom *= srcp->ss2;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines