BMesh: decimate, test for face flip was too low

Created overlapping faces in T44780
This commit is contained in:
Campbell Barton 2015-05-20 23:35:39 +10:00
parent 24e1d7f4f4
commit b5bf5b36f1
Notes: blender-bot 2023-02-14 09:06:12 +01:00
Referenced by issue #44780, Decimate Planar generates concave edges
1 changed files with 8 additions and 4 deletions

View File

@ -171,13 +171,15 @@ static bool bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_
cross_v3_v3v3(cross_exist, vec_other, vec_exist);
cross_v3_v3v3(cross_optim, vec_other, vec_optim);
/* normalize isn't really needed, but ensures the value at a unit we can compare against */
normalize_v3(cross_exist);
normalize_v3(cross_optim);
/* avoid normalize */
if (dot_v3v3(cross_exist, cross_optim) <=
(len_squared_v3(cross_exist) + len_squared_v3(cross_optim)) * 0.01f)
{
return true;
}
#else
normal_tri_v3(cross_exist, v->co, co_prev, co_next);
normal_tri_v3(cross_optim, optimize_co, co_prev, co_next);
#endif
/* use a small value rather then zero so we don't flip a face in multiple steps
* (first making it zero area, then flipping again) */
@ -185,6 +187,8 @@ static bool bm_edge_collapse_is_degenerate_flip(BMEdge *e, const float optimize_
//printf("no flip\n");
return true;
}
#endif
}
}
}