ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/bsdfinterp.c
(Generate patch)

Comparing ray/src/cv/bsdfinterp.c (file contents):
Revision 2.14 by greg, Tue Oct 22 04:29:27 2013 UTC vs.
Revision 2.16 by greg, Tue Feb 18 16:06:51 2014 UTC

# Line 94 | Line 94 | on_edge(const MIGRATION *ej, const FVECT ivec)
94          cos_a = DOT(ej->rbfv[0]->invec, ivec);
95          if (cos_a <= 0)
96                  return(0);
97 +        if (cos_a >= 1.)                /* handles rounding error */
98 +                return(1);
99  
100          cos_b = DOT(ej->rbfv[1]->invec, ivec);
101          if (cos_b <= 0)
102                  return(0);
103 +        if (cos_b >= 1.)
104 +                return(1);
105  
106          cos_aplusb = cos_a*cos_b - sqrt((1.-cos_a*cos_a)*(1.-cos_b*cos_b));
107          if (cos_aplusb <= 0)
# Line 204 | Line 208 | get_interp(MIGRATION *miga[3], FVECT invec)
208          if (single_plane_incident) {            /* isotropic BSDF? */
209              RBFNODE     *rbf;                   /* find edge we're on */
210              for (rbf = dsf_list; rbf != NULL; rbf = rbf->next) {
211 <                if (input_orient*rbf->invec[2] < input_orient*invec[2])
211 >                if (input_orient*rbf->invec[2] < input_orient*invec[2]-FTINY)
212                          break;
213                  if (rbf->next != NULL && input_orient*rbf->next->invec[2] <
214 <                                                        input_orient*invec[2]) {
214 >                                                input_orient*invec[2]+FTINY) {
215                      for (miga[0] = rbf->ejl; miga[0] != NULL;
216                                          miga[0] = nextedge(rbf,miga[0]))
217                          if (opp_rbf(rbf,miga[0]) == rbf->next) {
# Line 344 | Line 348 | memerr:
348          return(NULL);   /* pro forma return */
349   }
350  
351 < /* Partially advect between recorded incident angles and allocate new RBF */
351 > /* Advect between recorded incident angles and allocate new RBF */
352   RBFNODE *
353   advect_rbf(const FVECT invec, int lobe_lim)
354   {
# Line 371 | Line 375 | advect_rbf(const FVECT invec, int lobe_lim)
375                  return(rbf);
376          }
377   #ifdef DEBUG
378 <        if (miga[0]->rbfv[0] != miga[2]->rbfv[0] |
379 <                        miga[0]->rbfv[1] != miga[1]->rbfv[0] |
380 <                        miga[1]->rbfv[1] != miga[2]->rbfv[1]) {
378 >        if ((miga[0]->rbfv[0] != miga[2]->rbfv[0]) |
379 >                        (miga[0]->rbfv[1] != miga[1]->rbfv[0]) |
380 >                        (miga[1]->rbfv[1] != miga[2]->rbfv[1])) {
381                  fprintf(stderr, "%s: Triangle vertex screw-up!\n", progname);
382                  exit(1);
383          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines