[Bf-blender-cvs] [d7033d5] master: Fix T37691: Screw modifier created zero length normals

Campbell Barton noreply at git.blender.org
Wed Dec 18 21:58:10 CET 2013


Commit: d7033d56371e1cb4dc9b8e6fc8732affe3d50d60
Author: Campbell Barton
Date:   Thu Dec 19 07:53:20 2013 +1100
http://developer.blender.org/rBd7033d56371e1cb4dc9b8e6fc8732affe3d50d60

Fix T37691: Screw modifier created zero length normals

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

M	source/blender/modifiers/intern/MOD_screw.c

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

diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 85a5047..640ed92 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -746,12 +746,23 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 						}
 					}
 
-					/* vc_no_tmp2 - is a line 90d from the pivot to the vec
+					/* tmp_vec2 - is a line 90d from the pivot to the vec
 					 * This is used so the resulting normal points directly away from the middle */
 					cross_v3_v3v3(tmp_vec2, axis_vec, vc->co);
 
-					/* edge average vector and right angle to the pivot make the normal */
-					cross_v3_v3v3(vc->no, tmp_vec1, tmp_vec2);
+					if (UNLIKELY(is_zero_v3(tmp_vec2))) {
+						/* we're _on_ the axis, so copy it based on our winding */
+						if (vc->e[0]->v2 == i) {
+							negate_v3_v3(vc->no, axis_vec);
+						}
+						else {
+							copy_v3_v3(vc->no, axis_vec);
+						}
+					}
+					else {
+						/* edge average vector and right angle to the pivot make the normal */
+						cross_v3_v3v3(vc->no, tmp_vec1, tmp_vec2);
+					}
 
 				}
 				else {




More information about the Bf-blender-cvs mailing list