--- ray/src/cv/bsdfinterp.c 2014/02/19 05:16:06 2.17 +++ ray/src/cv/bsdfinterp.c 2014/08/21 10:33:48 2.19 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdfinterp.c,v 2.17 2014/02/19 05:16:06 greg Exp $"; +static const char RCSid[] = "$Id: bsdfinterp.c,v 2.19 2014/08/21 10:33:48 greg Exp $"; #endif /* * Interpolate BSDF data from radial basis functions in advection mesh. @@ -215,13 +215,14 @@ get_interp(MIGRATION *miga[3], FVECT invec) for (miga[0] = rbf->ejl; miga[0] != NULL; miga[0] = nextedge(rbf,miga[0])) if (opp_rbf(rbf,miga[0]) == rbf->next) { - double nf = 1. - rbf->invec[2]*rbf->invec[2]; + double nf = 1. - + rbf->next->invec[2]*rbf->next->invec[2]; if (nf > FTINY) { /* rotate to match */ nf = sqrt((1.-invec[2]*invec[2])/nf); - invec[0] = nf*rbf->invec[0]; - invec[1] = nf*rbf->invec[1]; + invec[0] = nf*rbf->next->invec[0]; + invec[1] = nf*rbf->next->invec[1]; } - return(0); + return(0); /* rotational symmetry */ } break; } @@ -262,6 +263,8 @@ get_interp(MIGRATION *miga[3], FVECT invec) } } +/* + /* Advect between recorded incident angles and allocate new RBF */ RBFNODE * advect_rbf(const FVECT invec, int lobe_lim) @@ -279,7 +282,7 @@ advect_rbf(const FVECT invec, int lobe_lim) VCOPY(sivec, invec); /* find triangle/edge */ sym = get_interp(miga, sivec); if (sym < 0) /* can't interpolate? */ - return(NULL); + return(def_rbf_spec(invec)); if (miga[1] == NULL) { /* advect along edge? */ rbf = e_advect_rbf(miga[0], sivec, lobe_lim); if (single_plane_incident)