Fix T52871: `BLI_polyfill_beautify_quad_rotate_calc_ex` was mistakenly considering the state as degenerated
This commit is contained in:
parent
c0480bc972
commit
a8f11f5422
Notes:
blender-bot
2023-02-14 06:32:26 +01:00
Referenced by commit 293dc4e084
, Revert "Fix T52871: `BLI_polyfill_beautify_quad_rotate_calc_ex` was mistakenly considering the state as degenerated"
Referenced by issue #53683, 2.79a release
Referenced by issue #52871, beauty fill error with daily build
|
@ -133,12 +133,21 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(
|
|||
{
|
||||
/* not a loop (only to be able to break out) */
|
||||
do {
|
||||
const float area_2x_234 = cross_tri_v2(v2, v3, v4);
|
||||
const float area_2x_241 = cross_tri_v2(v2, v4, v1);
|
||||
bool is_zero_a, is_zero_b;
|
||||
|
||||
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) &&
|
||||
|
@ -149,9 +158,7 @@ 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 (((area_2x_123 >= 0.0f) != (area_2x_134 >= 0.0f)) ||
|
||||
(fabsf(area_2x_123) <= FLT_EPSILON) || (fabsf(area_2x_134) <= FLT_EPSILON))
|
||||
{
|
||||
if (is_zero_a || is_zero_b || ((area_2x_123 >= 0.0f) != (area_2x_134 >= 0.0f))) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -159,12 +166,7 @@ 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)))
|
||||
{
|
||||
if (lock_degenerate) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
return -FLT_MAX; /* always rotate */
|
||||
}
|
||||
return -FLT_MAX; /* always rotate */
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue