Fix T49478: triangulate of face hangs Blender.

Another case of float imprecision leading to endless loop. INcreasing a bit 'noise threashold' seems to work OK.

Not a regression, but might be nice to have in 2.78a.
This commit is contained in:
Bastien Montagne 2016-09-28 20:03:59 +02:00
parent 0ec87f1227
commit 344a669c41
Notes: blender-bot 2023-02-14 08:06:33 +01:00
Referenced by issue #49478, triangulate of face hangs Blender
1 changed files with 3 additions and 2 deletions

View File

@ -239,8 +239,9 @@ static void polyedge_beauty_cost_update_single(
const float cost = polyedge_rotate_beauty_calc(coords, tris, e);
/* We can get cases where both choices generate very small negative costs, which leads to infinite loop.
* Anyway, costs above that are not worth recomputing, maybe we could even optimize it to a smaller limit?
* See T43578. */
if (cost < -FLT_EPSILON) {
* Actually, FLT_EPSILON is too small in some cases, 1e-6f seems to work OK hopefully?
* See T43578, T49478. */
if (cost < -1e-6f) {
eheap_table[i] = BLI_heap_insert(eheap, cost, e);
}
else {