diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-25 09:54:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-26 05:14:04 +0300 |
commit | 293dc4e084ebd248b85e0ce11bf42c307669d80f (patch) | |
tree | 3ec6885c050dcee7fed3f9cfa5aa8b5d40453f82 /source/blender/blenlib | |
parent | 262ddbfda062808f2f7623e8f8275277627cb3db (diff) |
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.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/polyfill2d_beautify.c | 24 |
1 files changed, 11 insertions, 13 deletions
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 */ + } } { |