diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-05-20 16:35:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-05-20 17:00:13 +0300 |
commit | b5bf5b36f127079f81929ec970ec4d562f92d601 (patch) | |
tree | 3934649bb8007dd39a27fc8c70cf12ce6b0d5a5f /source/blender/bmesh/tools/bmesh_decimate_collapse.c | |
parent | 24e1d7f4f4aba8e94effd6aec4a3d7d8308d4015 (diff) |
BMesh: decimate, test for face flip was too low
Created overlapping faces in T44780
Diffstat (limited to 'source/blender/bmesh/tools/bmesh_decimate_collapse.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_collapse.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index f2e2d25c0a6..a265784a985 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -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 + } } } |