diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-26 05:59:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-03 14:49:50 +0300 |
commit | 1b6130533f38c1293e0b65204df0aa64b4b0b1d9 (patch) | |
tree | 0f05f1b6d9acc4fed68918a7ca2fe768fbad7d9e | |
parent | 9d501d23cb0d3b506cf049618749dbdc3ddcefc6 (diff) |
Beauty fill was skipping small faces
-rw-r--r-- | source/blender/blenlib/intern/polyfill2d_beautify.c | 7 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_beautify.c | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/polyfill2d_beautify.c b/source/blender/blenlib/intern/polyfill2d_beautify.c index b563e286a48..5f6fb8e6cd4 100644 --- a/source/blender/blenlib/intern/polyfill2d_beautify.c +++ b/source/blender/blenlib/intern/polyfill2d_beautify.c @@ -133,6 +133,8 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex( { /* not a loop (only to be able to break out) */ do { + /* Allow very small faces to be considered non-zero. */ + const float eps_zero_area = 1e-12f; const float area_2x_234 = cross_tri_v2(v2, v3, v4); const float area_2x_241 = cross_tri_v2(v2, v4, v1); @@ -143,7 +145,6 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex( (ELEM(v2, v1, v3, v4) == false) && (ELEM(v3, v1, v2, v4) == false) && (ELEM(v4, v1, v2, v3) == false)); - /* * Test for unusable (1-3) state. * - Area sign flipping to check faces aren't going to point in opposite directions. @@ -152,7 +153,7 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex( 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)) { + else if ((fabsf(area_2x_123) <= eps_zero_area) || (fabsf(area_2x_134) <= eps_zero_area)) { break; } @@ -165,7 +166,7 @@ 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)) { + else if ((fabsf(area_2x_234) <= eps_zero_area) || (fabsf(area_2x_241) <= eps_zero_area)) { return -FLT_MAX; /* always rotate */ } diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c index 78e3e66b70a..6e6242fc9f9 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.c +++ b/source/blender/bmesh/tools/bmesh_beautify.c @@ -150,7 +150,7 @@ static float bm_edge_calc_rotate_beauty__area( (ELEM(v4, v1, v2, v3) == false)); add_v3_v3v3(no, no_a, no_b); - if (UNLIKELY((no_scale = normalize_v3(no)) <= FLT_EPSILON)) { + if (UNLIKELY((no_scale = normalize_v3(no)) == 0.0f)) { break; } |