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 2.50 by greg, Wed May 7 16:02:26 2014 UTC vs.
Revision 2.52 by greg, Wed May 7 21:45:13 2014 UTC

# Line 725 | Line 725 | ambcorral(AMBHEMI *hp, FVECT uv[2], const double r0, c
725          const double    max_d = 1.0/(minarad*ambacc + 0.001);
726          const double    ang_res = 0.5*PI/(hp->ns-1);
727          const double    ang_step = ang_res/((int)(16/PI*ang_res) + (1+FTINY));
728 +        double          avg_d = 0;
729          uint32          flgs = 0;
730          int             i, j;
731 <                                        /* circle around perimeter */
731 >                                        /* don't bother for a few samples */
732 >        if (hp->ns < 12)
733 >                return(0);
734 >                                        /* check distances overhead */
735 >        for (i = hp->ns*3/4; i-- > hp->ns>>2; )
736 >            for (j = hp->ns*3/4; j-- > hp->ns>>2; )
737 >                avg_d += ambsam(hp,i,j).d;
738 >        avg_d *= 4.0/(hp->ns*hp->ns);
739 >        if (avg_d*r0 >= 1.0)            /* ceiling too low for corral? */
740 >                return(0);
741 >        if (avg_d >= max_d)             /* insurance */
742 >                return(0);
743 >                                        /* else circle around perimeter */
744          for (i = 0; i < hp->ns; i++)
745              for (j = 0; j < hp->ns; j += !i|(i==hp->ns-1) ? 1 : hp->ns-1) {
746                  AMBSAMP *ap = &ambsam(hp,i,j);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines