28 |
|
register int i; |
29 |
|
/* set number of divisions */ |
30 |
|
if (ambacc <= FTINY && |
31 |
< |
wt > (d = 0.8*bright(ac)*r->rweight/(ambdiv*minweight))) |
31 |
> |
wt > (d = 0.8*intens(ac)*r->rweight/(ambdiv*minweight))) |
32 |
|
wt = d; /* avoid ray termination */ |
33 |
|
hp->nt = sqrt(ambdiv * wt / PI) + 0.5; |
34 |
|
i = ambacc > FTINY ? 3 : 1; /* minimum number of samples */ |
94 |
|
ar.rdir[i] = xd*h->ux[i] + |
95 |
|
yd*h->uy[i] + |
96 |
|
zd*h->uz[i]; |
97 |
+ |
checknorm(ar.rdir); |
98 |
|
dimlist[ndims++] = dp->t*h->np + dp->p + 90171; |
99 |
|
rayvalue(&ar); |
100 |
|
ndims--; |
205 |
|
else |
206 |
|
addcolor(acol, dp->v); |
207 |
|
} |
208 |
< |
if (!divcnt) |
208 |
> |
if (!divcnt) { |
209 |
> |
if (div != NULL) |
210 |
> |
free((void *)div); |
211 |
|
return(0.0); /* no samples taken */ |
212 |
+ |
} |
213 |
|
if (divcnt < hemi.nt*hemi.np) { |
214 |
|
pg = dg = NULL; /* incomplete sampling */ |
215 |
|
hemi.ns = 0; |