--- ray/src/rt/ambcomp.c 1991/06/13 13:58:24 1.8 +++ ray/src/rt/ambcomp.c 1991/07/24 10:36:13 1.10 @@ -72,9 +72,9 @@ RAY *r; hlist[1] = dp->t; hlist[2] = dp->p; hlist[3] = 0; - zd = sqrt((dp->t+urand(ilhash(hlist,4)+dp->n))/h->nt); + zd = sqrt((dp->t+urand(urind(ilhash(hlist,4),dp->n)))/h->nt); hlist[3] = 1; - phi = 2.0*PI * (dp->p+urand(ilhash(hlist,4)+dp->n))/h->np; + phi = 2.0*PI * (dp->p+urand(urind(ilhash(hlist,4),dp->n)))/h->np; xd = cos(phi) * zd; yd = sin(phi) * zd; zd = sqrt(1.0 - zd*zd); @@ -235,8 +235,8 @@ RAY *r; { register int i; /* set number of divisions */ - hp->nt = sqrt(ambdiv * r->rweight * 0.5) + 0.5; - hp->np = 2 * hp->nt; + hp->nt = sqrt(ambdiv * r->rweight / PI) + 0.5; + hp->np = PI * hp->nt; /* make axes */ VCOPY(hp->uz, r->ron); hp->uy[0] = hp->uy[1] = hp->uy[2] = 0.0;