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

Comparing ray/src/rt/ambcomp.c (file contents):
Revision 1.6 by greg, Thu Jun 13 10:54:00 1991 UTC vs.
Revision 1.10 by greg, Wed Jul 24 10:36:13 1991 UTC

# Line 72 | Line 72 | RAY  *r;
72          hlist[1] = dp->t;
73          hlist[2] = dp->p;
74          hlist[3] = 0;
75 <        zd = sqrt((dp->t+urand(ilhash(hlist,4)+dp->n))/h->nt);
75 >        zd = sqrt((dp->t+urand(urind(ilhash(hlist,4),dp->n)))/h->nt);
76          hlist[3] = 1;
77 <        phi = 2.0*PI * (dp->p+urand(ilhash(hlist,4)+dp->n))/h->np;
77 >        phi = 2.0*PI * (dp->p+urand(urind(ilhash(hlist,4),dp->n)))/h->np;
78          xd = cos(phi) * zd;
79          yd = sin(phi) * zd;
80          zd = sqrt(1.0 - zd*zd);
# Line 86 | Line 86 | RAY  *r;
86          rayvalue(&ar);
87          ndims--;
88          addcolor(dp->v, ar.rcol);
89 <        if (ar.rt < FHUGE)
89 >        if (ar.rt > FTINY && ar.rt < FHUGE)
90                  dp->r += 1.0/ar.rt;
91                                          /* (re)initialize error */
92          if (dp->n++) {
# Line 213 | Line 213 | FVECT  pg, dg;
213          else if (arad < minarad)
214                  arad = minarad;
215          arad /= sqrt(r->rweight);
216 +        if (pg != NULL) {               /* clip pos. gradient if too large */
217 +                d = 4.0*DOT(pg,pg)*arad*arad;
218 +                if (d > 1.0) {
219 +                        d = 1.0/sqrt(d);
220 +                        for (i = 0; i < 3; i++)
221 +                                pg[i] *= d;
222 +                }
223 +        }
224          return(arad);
225   oopsy:
226          if (div != NULL)
# Line 227 | Line 235 | RAY  *r;
235   {
236          register int  i;
237                                          /* set number of divisions */
238 <        hp->nt = sqrt(ambdiv * r->rweight * 0.5) + 0.5;
239 <        hp->np = 2 * hp->nt;
238 >        hp->nt = sqrt(ambdiv * r->rweight / PI) + 0.5;
239 >        hp->np = PI * hp->nt;
240                                          /* make axes */
241          VCOPY(hp->uz, r->ron);
242          hp->uy[0] = hp->uy[1] = hp->uy[2] = 0.0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines