diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-08-30 03:46:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-08-30 03:50:06 +0300 |
commit | 2fca31a5d6558ea1543cf0163eb4b74368040ee7 (patch) | |
tree | bc1d62f306b43e6c0e837a5c130abd110c9479df /source/blender/blenlib | |
parent | 7c44182c4a957bda032c49d15513682b6bbe705e (diff) |
Cleanup: no need to zero the area in beautify calculation
Also correct comment.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/polyfill_2d_beautify.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/source/blender/blenlib/intern/polyfill_2d_beautify.c b/source/blender/blenlib/intern/polyfill_2d_beautify.c index c7771bdf984..ab397b86b1a 100644 --- a/source/blender/blenlib/intern/polyfill_2d_beautify.c +++ b/source/blender/blenlib/intern/polyfill_2d_beautify.c @@ -75,7 +75,7 @@ static int oedge_cmp(const void *a1, const void *a2) return -1; } - /* only for pradictability */ + /* Only for predictability. */ if (x1->e_half > x2->e_half) { return 1; } @@ -126,6 +126,13 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(const float v1[2], BLI_assert((ELEM(v1, v2, v3, v4) == false) && (ELEM(v2, v1, v3, v4) == false) && (ELEM(v3, v1, v2, v4) == false) && (ELEM(v4, v1, v2, v3) == false)); + + if (r_area) { + *r_area = fabsf(area_2x_234) + fabsf(area_2x_241) + + /* Include both pairs for predictable results. */ + fabsf(area_2x_123) + fabsf(area_2x_134) / 8.0f; + } + /* * Test for unusable (1-3) state. * - Area sign flipping to check faces aren't going to point in opposite directions. @@ -186,21 +193,11 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(const float v1[2], prim_b = len_34 + len_41 + len_13; fac_13 = (area_a / prim_a) + (area_b / prim_b); - if (r_area) { - *r_area = fabsf(area_2x_234) + fabsf(area_2x_241) + - /* Include both pairs for predictable results. */ - fabsf(area_2x_123) + fabsf(area_2x_134) / 8.0f; - } - /* negative number if (1-3) is an improved state */ return fac_24 - fac_13; } } while (false); - if (r_area) { - *r_area = 0.0f; - } - return FLT_MAX; } @@ -241,7 +238,7 @@ static void polyedge_beauty_cost_update_single(const float (*coords)[2], * See T43578, T49478. * * In fact a larger epsilon can still fail when the area of the face is very large, - * how the epsilon is scaled by the face area. + * now the epsilon is scaled by the face area. * See T56532. */ if (cost < -1e-6f * max_ff(area, 1.0f)) { BLI_heap_insert_or_update(eheap, &eheap_table[i], cost, e); |