[Bf-blender-cvs] [344a669] master: Fix T49478: triangulate of face hangs Blender.

Bastien Montagne noreply at git.blender.org
Wed Sep 28 20:05:55 CEST 2016


Commit: 344a669c412a5eb5b71555a18aa85ef7a16b253f
Author: Bastien Montagne
Date:   Wed Sep 28 20:03:59 2016 +0200
Branches: master
https://developer.blender.org/rB344a669c412a5eb5b71555a18aa85ef7a16b253f

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.

===================================================================

M	source/blender/blenlib/intern/polyfill2d_beautify.c

===================================================================

diff --git a/source/blender/blenlib/intern/polyfill2d_beautify.c b/source/blender/blenlib/intern/polyfill2d_beautify.c
index 46f9251..896177f 100644
--- a/source/blender/blenlib/intern/polyfill2d_beautify.c
+++ b/source/blender/blenlib/intern/polyfill2d_beautify.c
@@ -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 {




More information about the Bf-blender-cvs mailing list