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.8 by greg, Tue Feb 25 02:47:23 2003 UTC vs.
Revision 2.12 by greg, Sat Dec 6 01:08:53 2008 UTC

# Line 57 | Line 57 | nextsample:
57                  d = urand(ilhash(dimlist,ndims+2)+samplendx);
58                  if (source[si->sn].sflags & SFLAT) {
59                          multisamp(vpos, 2, d);
60 <                        vpos[2] = 0.5;
60 >                        vpos[SW] = 0.5;
61                  } else
62                          multisamp(vpos, 3, d);
63                  for (i = 0; i < 3; i++)
# Line 68 | Line 68 | nextsample:
68  
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) {
73 +                FVECT   trim;
74 +                double  d;
75 +                if (source[si->sn].sflags & (SFLAT|SDISTANT)) {
76 +                        d = 1.12837917;         /* correct setflatss() */
77 +                        trim[SU] = d*sqrt(1.0 - 0.5*vpos[SV]*vpos[SV]);
78 +                        trim[SV] = d*sqrt(1.0 - 0.5*vpos[SU]*vpos[SU]);
79 +                        trim[SW] = 0.0;
80 +                } else {
81 +                        trim[SW] = trim[SU] = vpos[SU]*vpos[SU];
82 +                        d = vpos[SV]*vpos[SV];
83 +                        if (d > trim[SW]) trim[SW] = d;
84 +                        trim[SU] += d;
85 +                        d = vpos[SW]*vpos[SW];
86 +                        if (d > trim[SW]) trim[SW] = d;
87 +                        trim[SU] += d;
88 +                        d = 1.0/0.7236;         /* correct sphsetsrc() */
89 +                        trim[SW] = trim[SV] = trim[SU] =
90 +                                        d*sqrt(trim[SW]/trim[SU]);
91 +                }
92 +                for (i = 0; i < 3; i++)
93 +                        vpos[i] *= trim[i];
94 +        }
95                                          /* compute direction */
96          for (i = 0; i < 3; i++)
97                  r->rdir[i] = source[si->sn].sloc[i] +
# Line 114 | Line 138 | unsigned char  *pt;            /* partition array */
138                                          /* check this partition */
139          p = spart(pt, pp[0]);
140          pp[0]++;
141 <        if (p == S0)                    /* leaf partition */
141 >        if (p == S0) {                  /* leaf partition */
142                  if (pp[1]) {
143                          pp[1]--;
144                          return(0);      /* not there yet */
145                  } else
146                          return(1);      /* we've arrived */
147 +        }
148                                  /* else check lower */
149          sz[p] >>= 1;
150          ct[p] -= sz[p];
# Line 229 | Line 254 | flatpart(si, r)                                /* partition a flat source */
254   register SRCINDEX  *si;
255   register RAY  *r;
256   {
257 <        register FLOAT  *vp;
257 >        register RREAL  *vp;
258          FVECT  v;
259          double  du2, dv2;
260          int  pi;
# Line 240 | Line 265 | register RAY  *r;
265          v[1] = r->rorg[1] - vp[1];
266          v[2] = r->rorg[2] - vp[2];
267          vp = source[si->sn].snorm;
268 <        if (DOT(v,vp) <= FTINY) {       /* behind source */
268 >        if (DOT(v,vp) <= 0.) {          /* behind source */
269                  si->np = 0;
270                  return;
271          }
# Line 313 | Line 338 | scylform(sn, dir)              /* compute cosine for cylinder's pr
338   int  sn;
339   register FVECT  dir;            /* assume normalized */
340   {
341 <        register FLOAT  *dv;
341 >        register RREAL  *dv;
342          double  d;
343  
344          dv = source[sn].ss[SU];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines