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.57 by greg, Fri May 9 22:53:11 2014 UTC vs.
Revision 2.58 by greg, Sun May 11 19:03:37 2014 UTC

# Line 600 | Line 600 | ambcorral(AMBHEMI *hp, FVECT uv[2], const double r0, c
600          const double    ang_step = ang_res/((int)(16/PI*ang_res) + (1+FTINY));
601          double          avg_d = 0;
602          uint32          flgs = 0;
603 +        FVECT           vec;
604 +        double          u, v;
605 +        double          ang, a1;
606          int             i, j;
607                                          /* don't bother for a few samples */
608          if (hp->ns < 12)
# Line 617 | Line 620 | ambcorral(AMBHEMI *hp, FVECT uv[2], const double r0, c
620          for (i = 0; i < hp->ns; i++)
621              for (j = 0; j < hp->ns; j += !i|(i==hp->ns-1) ? 1 : hp->ns-1) {
622                  AMBSAMP *ap = &ambsam(hp,i,j);
620                FVECT   vec;
621                double  u, v;
622                double  ang, a1;
623                int     abp;
623                  if ((ap->d <= FTINY) | (ap->d >= max_d))
624                          continue;       /* too far or too near */
625                  VSUB(vec, ap->p, hp->rp->rop);
# Line 632 | Line 631 | ambcorral(AMBHEMI *hp, FVECT uv[2], const double r0, c
631                  for (a1 = ang-.5*ang_res; a1 <= ang+.5*ang_res; a1 += ang_step)
632                          flgs |= 1L<<(int)(16/PI*(a1 + 2.*PI*(a1 < 0)));
633              }
634 +                                        /* add low-angle incident (< 20deg) */
635 +        if (fabs(hp->rp->rod) <= 0.342) {
636 +                u = -DOT(hp->rp->rdir, uv[0]);
637 +                v = -DOT(hp->rp->rdir, uv[1]);
638 +                if ((r0*r0*u*u + r1*r1*v*v) > hp->rp->rot*hp->rp->rot) {
639 +                        ang = atan2a(v, u);
640 +                        ang += 2.*PI*(ang < 0);
641 +                        ang *= 16/PI;
642 +                        if ((ang < .5) | (ang >= 31.5))
643 +                                flgs |= 0x80000001;
644 +                        else
645 +                                flgs |= 3L<<(int)(ang-.5);
646 +                }
647 +        }
648          return(flgs);
649   }
650  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines