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.9 by greg, Fri Dec 14 22:41:44 2012 UTC vs.
Revision 2.10 by greg, Fri Dec 14 23:16:43 2012 UTC

# Line 202 | Line 202 | get_interp(MIGRATION *miga[3], FVECT invec)
202   {
203          miga[0] = miga[1] = miga[2] = NULL;
204          if (single_plane_incident) {            /* isotropic BSDF? */
205 <                RBFNODE *rbf;                   /* find edge we're on */
206 <                for (rbf = dsf_list; rbf != NULL; rbf = rbf->next) {
207 <                        if (input_orient*rbf->invec[2] < input_orient*invec[2])
208 <                                break;
209 <                        if (rbf->next != NULL &&
210 <                                        input_orient*rbf->next->invec[2] <
205 >            RBFNODE     *rbf;                   /* find edge we're on */
206 >            for (rbf = dsf_list; rbf != NULL; rbf = rbf->next) {
207 >                if (input_orient*rbf->invec[2] < input_orient*invec[2])
208 >                        break;
209 >                if (rbf->next != NULL && input_orient*rbf->next->invec[2] <
210                                                          input_orient*invec[2]) {
211 <                                for (miga[0] = rbf->ejl; miga[0] != NULL;
212 <                                                miga[0] = nextedge(rbf,miga[0]))
213 <                                        if (opp_rbf(rbf,miga[0]) == rbf->next) {
214 <                                                double  nf = 1.-rbf->invec[2]*rbf->invec[2];
215 <                                                if (nf > FTINY) {
216 <                                                        nf = sqrt((1.-invec[2]*invec[2])/nf);
217 <                                                        invec[0] = nf*rbf->invec[0];
218 <                                                        invec[1] = nf*rbf->invec[1];
219 <                                                }
220 <                                                return(0);
222 <                                        }
223 <                                break;
211 >                    for (miga[0] = rbf->ejl; miga[0] != NULL;
212 >                                        miga[0] = nextedge(rbf,miga[0]))
213 >                        if (opp_rbf(rbf,miga[0]) == rbf->next) {
214 >                                double  nf = 1. - rbf->invec[2]*rbf->invec[2];
215 >                                if (nf > FTINY) {       /* rotate to match */
216 >                                        nf = sqrt((1.-invec[2]*invec[2])/nf);
217 >                                        invec[0] = nf*rbf->invec[0];
218 >                                        invec[1] = nf*rbf->invec[1];
219 >                                }
220 >                                return(0);
221                          }
222 +                    break;
223                  }
224 <                return(-1);                     /* outside range! */
224 >            }
225 >            return(-1);                         /* outside range! */
226          }
227          {                                       /* else use triangle mesh */
228                  int             sym = use_symmetry(invec);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines