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.
This commit is contained in:
Bastien Montagne 2018-11-20 17:54:48 +01:00
parent c9c6433a59
commit ec851efda9
Notes: blender-bot 2023-02-14 05:00:04 +01:00
Referenced by issue #57923, Crash: Vertex snapping with Target: "Active" based on Pivot Point: "3D Cursor" when Active is at 3D Cursor location
1 changed files with 5 additions and 0 deletions

View File

@ -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;