[Bf-blender-cvs] [ec851efda93] master: Fix T57923: Freeze in mesh vnors computation code with some degenerated geometry.

Bastien Montagne noreply at git.blender.org
Tue Nov 20 17:56:36 CET 2018


Commit: ec851efda93ed19c9f7063c6167ae9437ed6803c
Author: Bastien Montagne
Date:   Tue Nov 20 17:54:48 2018 +0100
Branches: master
https://developer.blender.org/rBec851efda93ed19c9f7063c6167ae9437ed6803c

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.

===================================================================

M	source/blender/bmesh/intern/bmesh_mesh.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list