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.7 by greg, Sat Nov 10 19:47:42 2012 UTC vs.
Revision 2.8 by greg, Wed Mar 20 01:00:22 2013 UTC

# Line 438 | Line 438 | mesh_from_edge(MIGRATION *edge)
438                  }
439          }
440   }
441 +
442 + /* Compute minimum BSDF from histogram and clear it */
443 + static void
444 + comp_bsdf_min()
445 + {
446 +        int     cnt;
447 +        int     i, target;
448 +
449 +        cnt = 0;
450 +        for (i = HISTLEN; i--; )
451 +                cnt += bsdf_hist[i];
452 +
453 +        target = cnt/100;                       /* ignore bottom 1% */
454 +        cnt = 0;
455 +        for (i = 0; cnt <= target; i++)
456 +                cnt += bsdf_hist[i];
457 +        bsdf_min = histval(i-1);
458 +        memset(bsdf_hist, 0, sizeof(bsdf_hist));
459 + }
460          
461   /* Build our triangle mesh from recorded RBFs */
462   void
# Line 473 | Line 492 | build_mesh(void)
492                  mesh_from_edge(create_migration(shrt_edj[0], shrt_edj[1]));
493          else
494                  mesh_from_edge(create_migration(shrt_edj[1], shrt_edj[0]));
495 +                                                /* compute minimum BSDF */
496 +        comp_bsdf_min();
497                                                  /* complete migrations */
498          await_children(nchild);
499   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines