--- ray/src/rt/ambcomp.c 1992/03/04 16:28:25 2.3 +++ ray/src/rt/ambcomp.c 1995/05/03 09:46:31 2.5 @@ -27,9 +27,7 @@ typedef struct { short nt, np; /* number of theta and phi directions */ } AMBHEMI; /* ambient sample hemisphere */ -extern double sin(), cos(), sqrt(); - static int ambcmp(d1, d2) /* decreasing order */ AMBSAMP *d1, *d2; @@ -148,7 +146,9 @@ FVECT pg, dg; arad += dp->r; } } - if (ns > 0) { /* perform super-sampling */ + if (ns > 0 && arad > FTINY && ndivs/arad < minarad) + ns = 0; /* close enough */ + else if (ns > 0) { /* else perform super-sampling */ comperrs(div, &hemi); /* compute errors */ qsort(div, ndivs, sizeof(AMBSAMP), ambcmp); /* sort divs */ /* super-sample */