--- ray/src/rt/ambcomp.c 1996/04/23 11:06:54 2.6 +++ ray/src/rt/ambcomp.c 1998/12/16 18:14:57 2.8 @@ -1,7 +1,7 @@ -/* Copyright (c) 1991 Regents of the University of California */ +/* Copyright (c) 1998 Silicon Graphics, Inc. */ #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static char SCCSid[] = "$SunId$ SGI"; #endif /* @@ -73,8 +73,8 @@ RAY *r; multisamp(spt, 2, urand(ilhash(hlist,3)+dp->n)); zd = sqrt((dp->t + spt[0])/h->nt); phi = 2.0*PI * (dp->p + spt[1])/h->np; - xd = cos(phi) * zd; - yd = sin(phi) * zd; + xd = tcos(phi) * zd; + yd = tsin(phi) * zd; zd = sqrt(1.0 - zd*zd); for (i = 0; i < 3; i++) ar.rdir[i] = xd*h->ux[i] + @@ -84,8 +84,9 @@ RAY *r; rayvalue(&ar); ndims--; addcolor(dp->v, ar.rcol); - if (ar.rt > FTINY && ar.rt < FHUGE) - dp->r += 1.0/ar.rt; + /* be conservative and use rot */ + if (ar.rot > FTINY && ar.rot < FHUGE) + dp->r += 1.0/ar.rot; /* (re)initialize error */ if (dp->n++) { b2 = bright(dp->v)/dp->n - bright(ar.rcol); @@ -357,7 +358,7 @@ register AMBHEMI *hp; } mag0 *= 2.0*PI / hp->np; phi = 2.0*PI * (double)j/hp->np; - cosp = cos(phi); sinp = sin(phi); + cosp = tcos(phi); sinp = tsin(phi); xd += mag0*cosp - mag1*sinp; yd += mag0*sinp + mag1*cosp; } @@ -391,8 +392,8 @@ register AMBHEMI *hp; dp += hp->np; } phi = 2.0*PI * (j+.5)/hp->np + PI/2.0; - xd += mag * cos(phi); - yd += mag * sin(phi); + xd += mag * tcos(phi); + yd += mag * tsin(phi); } for (i = 0; i < 3; i++) gv[i] = (xd*hp->ux[i] + yd*hp->uy[i])/(hp->nt*hp->np);