diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-19 00:53:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-19 00:57:16 +0400 |
commit | d7033d56371e1cb4dc9b8e6fc8732affe3d50d60 (patch) | |
tree | a030a1c2adc0a6f966a4d4f2809729a160ddc5a1 /source/blender/modifiers/intern/MOD_screw.c | |
parent | 4b206af1c966119f5ce7b0ccf7f9d681a9032f7a (diff) |
Fix T37691: Screw modifier created zero length normals
Diffstat (limited to 'source/blender/modifiers/intern/MOD_screw.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_screw.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 85a50473527..640ed926908 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 { |