[Bf-blender-cvs] [efbe47f9cd] master: Fix T50662: Auto-split affects on smooth mesh when it sohuldn't

Sergey Sharybin noreply at git.blender.org
Wed Feb 15 16:24:49 CET 2017


Commit: efbe47f9cdb60761ade99094af3cb8f997c3255d
Author: Sergey Sharybin
Date:   Wed Feb 15 15:21:15 2017 +0100
Branches: master
https://developer.blender.org/rBefbe47f9cdb60761ade99094af3cb8f997c3255d

Fix T50662: Auto-split affects on smooth mesh when it sohuldn't

Seems to be a precision error comparing proper floating point
normal with the one coming from short.

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

M	source/blender/blenkernel/intern/mesh.c

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

diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 42b6a841da..6da86e3d15 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -2172,7 +2172,7 @@ void BKE_mesh_split_faces(Mesh *mesh)
 			MVert *mv = &mvert[ml->v];
 			float vn[3];
 			normal_short_to_float_v3(vn, mv->no);
-			if (!equals_v3v3(vn, lnors[mp->loopstart + loop])) {
+			if (len_squared_v3v3(vn, lnors[mp->loopstart + loop]) > FLT_EPSILON) {
 				/* When vertex is adjacent to two faces and gets split we don't
 				 * want new vertex counted for both faces. We tag it for re-use
 				 * by one of the faces.
@@ -2240,7 +2240,7 @@ void BKE_mesh_split_faces(Mesh *mesh)
 			MVert *mv = &mvert[ml->v];
 			float vn[3];
 			normal_short_to_float_v3(vn, mv->no);
-			if (!equals_v3v3(vn, lnors[mp->loopstart + loop])) {
+			if (len_squared_v3v3(vn, lnors[mp->loopstart + loop]) > FLT_EPSILON) {
 				if ((mv->flag & ME_VERT_TMP_TAG) == 0) {
 					/* Ignore first split on vertex, re-use it instead. */
 					mv->flag |= ME_VERT_TMP_TAG;




More information about the Bf-blender-cvs mailing list