[Bf-blender-cvs] [39fc93208a7] blender-v2.79a-release: Revert "Fix T52871: `BLI_polyfill_beautify_quad_rotate_calc_ex` was mistakenly considering the state as degenerated"

Campbell Barton noreply at git.blender.org
Wed Jan 3 12:48:18 CET 2018


Commit: 39fc93208a7c16e43cdba1d84a2fba99920c7c8e
Author: Campbell Barton
Date:   Mon Sep 25 16:54:36 2017 +1000
Branches: blender-v2.79a-release
https://developer.blender.org/rB39fc93208a7c16e43cdba1d84a2fba99920c7c8e

Revert "Fix T52871: `BLI_polyfill_beautify_quad_rotate_calc_ex` was mistakenly considering the state as degenerated"

This reverts commit a8f11f5422afa01608817755eea310e987f896be.

Result is no longer symmetrical, will investigate a different fix.

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

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 c727a2a9c45..287fe3c817e 100644
--- a/source/blender/blenlib/intern/polyfill2d_beautify.c
+++ b/source/blender/blenlib/intern/polyfill2d_beautify.c
@@ -133,21 +133,12 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(
 {
 	/* not a loop (only to be able to break out) */
 	do {
-		bool is_zero_a, is_zero_b;
+		const float area_2x_234 = cross_tri_v2(v2, v3, v4);
+		const float area_2x_241 = cross_tri_v2(v2, v4, v1);
 
 		const float area_2x_123 = cross_tri_v2(v1, v2, v3);
 		const float area_2x_134 = cross_tri_v2(v1, v3, v4);
 
-		is_zero_a = (fabsf(area_2x_123) <= FLT_EPSILON);
-		is_zero_b = (fabsf(area_2x_134) <= FLT_EPSILON);
-
-		if (lock_degenerate && is_zero_a && is_zero_b) {
-			break;
-		}
-
-		const float area_2x_234 = cross_tri_v2(v2, v3, v4);
-		const float area_2x_241 = cross_tri_v2(v2, v4, v1);
-
 		BLI_assert((ELEM(v1, v2, v3, v4) == false) &&
 		           (ELEM(v2, v1, v3, v4) == false) &&
 		           (ELEM(v3, v1, v2, v4) == false) &&
@@ -158,7 +149,9 @@ 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 (is_zero_a || is_zero_b || ((area_2x_123 >= 0.0f) != (area_2x_134 >= 0.0f))) {
+		if (((area_2x_123 >= 0.0f) != (area_2x_134 >= 0.0f)) ||
+		    (fabsf(area_2x_123) <= FLT_EPSILON) || (fabsf(area_2x_134) <= FLT_EPSILON))
+		{
 			break;
 		}
 
@@ -166,7 +159,12 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(
 		if (((area_2x_234 >= 0.0f) != (area_2x_241 >= 0.0f)) ||
 		    ((fabsf(area_2x_234) <= FLT_EPSILON) || (fabsf(area_2x_241) <= FLT_EPSILON)))
 		{
-			return -FLT_MAX;  /* always rotate */
+			if (lock_degenerate) {
+				break;
+			}
+			else {
+				return -FLT_MAX;  /* always rotate */
+			}
 		}
 
 		{



More information about the Bf-blender-cvs mailing list