[Bf-blender-cvs] [e40e29cd38a] master: Fix T52871: beauty fill error

Campbell Barton noreply at git.blender.org
Tue Sep 26 04:04:49 CEST 2017


Commit: e40e29cd38afdfd3e5e60712f97c4c3f92874058
Author: Campbell Barton
Date:   Tue Sep 26 12:14:46 2017 +1000
Branches: master
https://developer.blender.org/rBe40e29cd38afdfd3e5e60712f97c4c3f92874058

Fix T52871: beauty fill error

Only lock tri's facing different directions.
Needed because scanfill creates zero area faces.

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

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 287fe3c817e..b563e286a48 100644
--- a/source/blender/blenlib/intern/polyfill2d_beautify.c
+++ b/source/blender/blenlib/intern/polyfill2d_beautify.c
@@ -149,16 +149,15 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(
 		 * - Area sign flipping to check faces aren't going to point in opposite directions.
 		 * - Area epsilon check that the one of the faces won't be zero area.
 		 */
-		if (((area_2x_123 >= 0.0f) != (area_2x_134 >= 0.0f)) ||
-		    (fabsf(area_2x_123) <= FLT_EPSILON) || (fabsf(area_2x_134) <= FLT_EPSILON))
-		{
+		if ((area_2x_123 >= 0.0f) != (area_2x_134 >= 0.0f)) {
+			break;
+		}
+		else if ((fabsf(area_2x_123) <= FLT_EPSILON) || (fabsf(area_2x_134) <= FLT_EPSILON)) {
 			break;
 		}
 
 		/* Test for unusable (2-4) state (same as above). */
-		if (((area_2x_234 >= 0.0f) != (area_2x_241 >= 0.0f)) ||
-		    ((fabsf(area_2x_234) <= FLT_EPSILON) || (fabsf(area_2x_241) <= FLT_EPSILON)))
-		{
+		if ((area_2x_234 >= 0.0f) != (area_2x_241 >= 0.0f)) {
 			if (lock_degenerate) {
 				break;
 			}
@@ -166,6 +165,9 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(
 				return -FLT_MAX;  /* always rotate */
 			}
 		}
+		else if ((fabsf(area_2x_234) <= FLT_EPSILON) || (fabsf(area_2x_241) <= FLT_EPSILON)) {
+			return -FLT_MAX;  /* always rotate */
+		}
 
 		{
 			/* testing rule: the area divided by the perimeter,



More information about the Bf-blender-cvs mailing list