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

Comparing ray/src/cv/bsdfmesh.c (file contents):
Revision 2.11 by greg, Thu Oct 24 16:11:37 2013 UTC vs.
Revision 2.14 by greg, Fri Nov 8 03:42:13 2013 UTC

# Line 176 | Line 176 | price_routes(PRICEMAT *pm, const RBFNODE *from_rbf, co
176              pm->prow = pricerow(pm,i);
177              srow = psortrow(pm,i);
178              for (j = to_rbf->nrbf; j--; ) {
179 <                double          dprod = DOT(vfrom, vto[j]);
180 <                pm->prow[j] = ((dprod >= 1.) ? .0 : acos(dprod)) +
181 <                                fabs(R2ANG(to_rbf->rbfa[j].crad) - from_ang);
179 >                double          d;              /* quadratic cost function */
180 >                d = DOT(vfrom, vto[j]);
181 >                d = (d >= 1.) ? .0 : acos(d);
182 >                pm->prow[j] = d*d;
183 >                d = R2ANG(to_rbf->rbfa[j].crad) - from_ang;
184 >                pm->prow[j] += d*d;    
185                  srow[j] = j;
186              }
187              qsort_r(srow, pm->ncols, sizeof(short), pm, &msrt_cmp);
# Line 236 | Line 239 | migration_step(MIGRATION *mig, double *src_rem, double
239   {
240          const int       max2check = 100;
241          const double    maxamt = 1./(double)pm->ncols;
242 <        const double    minamt = maxamt*5e-6;
242 >        const double    minamt = maxamt*1e-4;
243          double          *src_cost;
244          short           (*rord)[2];
245          struct {
# Line 333 | Line 336 | create_migration(RBFNODE *from_rbf, RBFNODE *to_rbf)
336                          return(NULL);
337                                                  /* else allocate */
338   #ifdef DEBUG
339 <        fprintf(stderr, "Building path from (theta,phi) (%.0f,%.0f) ",
339 >        fprintf(stderr, "Building path from (theta,phi) (%.1f,%.1f) ",
340                          get_theta180(from_rbf->invec),
341                          get_phi360(from_rbf->invec));
342 <        fprintf(stderr, "to (%.0f,%.0f) with %d x %d matrix\n",
342 >        fprintf(stderr, "to (%.1f,%.1f) with %d x %d matrix\n",
343                          get_theta180(to_rbf->invec),
344                          get_phi360(to_rbf->invec),
345                          from_rbf->nrbf, to_rbf->nrbf);
# Line 404 | Line 407 | overlaps_tri(const RBFNODE *bv0, const RBFNODE *bv1, c
407          return(vother[im_rev] != NULL);
408   }
409  
410 < /* Find context hull vertex to complete triangle (oriented call) */
410 > /* Find convex hull vertex to complete triangle (oriented call) */
411   static RBFNODE *
412   find_chull_vert(const RBFNODE *rbf0, const RBFNODE *rbf1)
413   {
# Line 425 | Line 428 | find_chull_vert(const RBFNODE *rbf0, const RBFNODE *rb
428                  if (DOT(vp, vmid) <= FTINY)
429                          continue;               /* wrong orientation */
430                  area2 = .25*DOT(vp,vp);
431 <                VSUB(vp, rbf->invec, rbf0->invec);
431 >                VSUB(vp, rbf->invec, vmid);
432                  dprod = -DOT(vp, vejn);
433                  VSUM(vp, vp, vejn, dprod);      /* above guarantees non-zero */
434                  dprod = DOT(vp, vmid) / VLEN(vp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines