diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-20 19:54:48 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-20 19:54:48 +0300 |
commit | ec851efda93ed19c9f7063c6167ae9437ed6803c (patch) | |
tree | 354ce7d5956e98c2347699f7f04e2ca977f48b4e /source/blender/bmesh/intern/bmesh_mesh.c | |
parent | c9c6433a59549dbdf56298ae81a0b890639a6e0b (diff) |
Fix T57923: Freeze in mesh vnors computation code with some degenerated geometry.
Second part of the fix: do not try at all to compute normals in degenerated
geometry. Just loss of time and potential issues later with weird
invalid computed values.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_mesh.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 7a63fa3c64f..3fe54b7229a 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -392,6 +392,11 @@ static void mesh_verts_calc_normals_accum_cb(void *userdata, MempoolIterData *mp fac = saacos(-dotprod); + if (fac != fac) { /* NAN detection. */ + /* Degenerated case, nothing to do here, just ignore that vertex. */ + continue; + } + /* accumulate weighted face normal into the vertex's normal */ float *v_no = data->vnos ? data->vnos[BM_elem_index_get(l_iter->v)] : l_iter->v->no; |