Beauty fill was skipping small faces

This commit is contained in:
Campbell Barton 2017-09-26 12:59:23 +10:00
parent e40e29cd38
commit aba2f8ea67
Notes: blender-bot 2023-02-14 06:17:15 +01:00
Referenced by issue #53683, 2.79a release
2 changed files with 5 additions and 4 deletions

View File

@ -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 */
}

View File

@ -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;
}