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.4 by greg, Tue Oct 23 21:09:29 2012 UTC vs.
Revision 2.8 by greg, Wed Dec 12 04:49:59 2012 UTC

# Line 126 | Line 126 | in_tri(const RBFNODE *v1, const RBFNODE *v2, const RBF
126          return(sgn2 == sgn3);
127   }
128  
129 < /* Test and set for edge */
129 > /* Test (and set) bitmap for edge */
130   static int
131   check_edge(unsigned char *emap, int nedges, const MIGRATION *mig, int mark)
132   {
# Line 202 | Line 202 | get_interp(MIGRATION *miga[3], FVECT invec)
202                                                          input_orient*invec[2]) {
203                                  for (miga[0] = rbf->ejl; miga[0] != NULL;
204                                                  miga[0] = nextedge(rbf,miga[0]))
205 <                                        if (opp_rbf(rbf,miga[0]) == rbf->next)
205 >                                        if (opp_rbf(rbf,miga[0]) == rbf->next) {
206 >                                                double  nf = 1.-rbf->invec[2]*rbf->invec[2];
207 >                                                if (nf > FTINY) {
208 >                                                        nf = sqrt((1.-invec[2]*invec[2])/nf);
209 >                                                        invec[0] = nf*rbf->invec[0];
210 >                                                        invec[1] = nf*rbf->invec[1];
211 >                                                }
212                                                  return(0);
213 +                                        }
214                                  break;
215                          }
216                  }
# Line 247 | Line 254 | e_advect_rbf(const MIGRATION *mig, const FVECT invec)
254          double          t, full_dist;
255                                                  /* get relative position */
256          t = acos(DOT(invec, mig->rbfv[0]->invec));
257 <        if (t < M_PI/GRIDRES) {                 /* near first DSF */
257 >        if (t < M_PI/grid_res) {                /* near first DSF */
258                  n = sizeof(RBFNODE) + sizeof(RBFVAL)*(mig->rbfv[0]->nrbf-1);
259                  rbf = (RBFNODE *)malloc(n);
260                  if (rbf == NULL)
261                          goto memerr;
262                  memcpy(rbf, mig->rbfv[0], n);   /* just duplicate */
263 +                rbf->next = NULL; rbf->ejl = NULL;
264                  return(rbf);
265          }
266          full_dist = acos(DOT(mig->rbfv[0]->invec, mig->rbfv[1]->invec));
267 <        if (t > full_dist-M_PI/GRIDRES) {       /* near second DSF */
267 >        if (t > full_dist-M_PI/grid_res) {      /* near second DSF */
268                  n = sizeof(RBFNODE) + sizeof(RBFVAL)*(mig->rbfv[1]->nrbf-1);
269                  rbf = (RBFNODE *)malloc(n);
270                  if (rbf == NULL)
271                          goto memerr;
272                  memcpy(rbf, mig->rbfv[1], n);   /* just duplicate */
273 +                rbf->next = NULL; rbf->ejl = NULL;
274                  return(rbf);
275          }
276          t /= full_dist;
# Line 332 | Line 341 | advect_rbf(const FVECT invec)
341                  return(NULL);
342          if (miga[1] == NULL) {                  /* advect along edge? */
343                  rbf = e_advect_rbf(miga[0], sivec);
344 <                rev_rbf_symmetry(rbf, sym);
344 >                if (single_plane_incident)
345 >                        rotate_rbf(rbf, invec);
346 >                else
347 >                        rev_rbf_symmetry(rbf, sym);
348                  return(rbf);
349          }
350   #ifdef DEBUG
# Line 400 | Line 412 | advect_rbf(const FVECT invec)
412                      float               mc = mtx_coef(miga[2],i,k);
413                      const RBFVAL        *rbf2k;
414                      double              rad2k;
403                    FVECT               vout;
415                      int                 pos[2];
416                      if ((mb <= FTINY) & (mc <= FTINY))
417                          continue;
# Line 409 | Line 420 | advect_rbf(const FVECT invec)
420                      rad2k = R2ANG(rbf2k->crad);
421                      rbf->rbfa[n].crad = ANG2R(sqrt(srad2 + t*rad2k*rad2k));
422                      ovec_from_pos(v2, rbf2k->gx, rbf2k->gy);
423 <                    geodesic(vout, v1, v2, t, GEOD_REL);
424 <                    pos_from_vec(pos, vout);
423 >                    geodesic(v2, v1, v2, t, GEOD_REL);
424 >                    pos_from_vec(pos, v2);
425                      rbf->rbfa[n].gx = pos[0];
426                      rbf->rbfa[n].gy = pos[1];
427                      ++n;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines