diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-18 17:16:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-18 17:16:22 +0300 |
commit | a41fe949d8c346b246bdd1bff4ae50aee19ca859 (patch) | |
tree | a3e3f1e2b9559c54b1ac52ff6b5ffb167d97af84 /source/blender/modifiers/intern/MOD_surfacedeform.c | |
parent | 076616898bff0acfc2336351ee975bd0fef944b2 (diff) |
Fix T53398: Surface deform modifier says that convex polygons are concave for big faces
Dot-product for angle check need either to be divided by vectors magnitude or be
calculated for normalized vectors.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_surfacedeform.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_surfacedeform.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index b692137b604..f8bad417f0b 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -331,11 +331,13 @@ BLI_INLINE int isPolyValid(const float coords[][2], const unsigned int nr) copy_v2_v2(prev_co, coords[nr - 1]); sub_v2_v2v2(prev_vec, prev_co, coords[nr - 2]); + normalize_v2(prev_vec); for (int i = 0; i < nr; i++) { sub_v2_v2v2(curr_vec, coords[i], prev_co); - if (len_squared_v2(curr_vec) < FLT_EPSILON) { + const float curr_len = normalize_v2(curr_vec); + if (curr_len < FLT_EPSILON) { return MOD_SDEF_BIND_RESULT_OVERLAP_ERR; } |