[Bf-blender-cvs] [4c8d68c0329] master: Cleanup: replace degenerate check with assert

Campbell Barton noreply at git.blender.org
Tue Aug 17 07:16:47 CEST 2021


Commit: 4c8d68c03293a36fd28b3401833a465f24020ce5
Author: Campbell Barton
Date:   Tue Aug 17 15:14:09 2021 +1000
Branches: master
https://developer.blender.org/rB4c8d68c03293a36fd28b3401833a465f24020ce5

Cleanup: replace degenerate check with assert

Use an assert since this should never happen.

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

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

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

diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.c b/source/blender/bmesh/intern/bmesh_mesh_normals.c
index a5e41b74ee1..186c85abe58 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_normals.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_normals.c
@@ -85,10 +85,9 @@ BLI_INLINE void bm_vert_calc_normals_accum_loop(const BMLoop *l_iter,
     dotprod = -dotprod;
   }
   const float fac = saacos(-dotprod);
-  /* NAN detection, otherwise this is a degenerated case, ignore that vertex in this case. */
-  if (fac == fac) {
-    madd_v3_v3fl(v_no, f_no, fac);
-  }
+  /* Shouldn't happen as normalizing edge-vectors cause degenerate values to be zeroed out. */
+  BLI_assert(!isnan(fac));
+  madd_v3_v3fl(v_no, f_no, fac);
 }
 
 static void bm_vert_calc_normals_impl(BMVert *v)



More information about the Bf-blender-cvs mailing list