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 |
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 |
|
} |