diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-27 05:28:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-27 05:28:40 +0400 |
commit | b5d6f14290c02f17cce38e3f96594af76e0410ae (patch) | |
tree | 713c017a68f2b74b6b8a1ede041411bb44f74b58 /source/blender/blenlib | |
parent | 26133a96ae82f44de12c4952ddca07578ede752c (diff) |
Fix T38858: Crazy spaces was unpredictable with co-linear edges
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_rotation.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index c9f553c6fa5..54bfef4bd14 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -80,8 +80,8 @@ void mat3_to_quat(float q[4], float mat[3][3]); void mat4_to_quat(float q[4], float mat[4][4]); void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const float v3[3], const float no_orig[3]); -void tri_to_quat(float q[4], const float a[3], const float b[3], const float c[3]); -void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag); +float tri_to_quat(float q[4], const float a[3], const float b[3], const float c[3]); +void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag); /* note: v1 and v2 must be normalized */ void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3]); void rotation_between_quats_to_quat(float q[4], const float q1[4], const float q2[4]); diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 0392598769f..c7c0626019f 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -663,11 +663,17 @@ void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const f mul_qt_qtqt(quat, q1, q2); } -void tri_to_quat(float quat[4], const float v1[3], const float v2[3], const float v3[3]) +/** + * \return the length of the normal, use to test for degenerate triangles. + */ +float tri_to_quat(float quat[4], const float v1[3], const float v2[3], const float v3[3]) { float vec[3]; - normal_tri_v3(vec, v1, v2, v3); + float len; + + len = normal_tri_v3(vec, v1, v2, v3); tri_to_quat_ex(quat, v1, v2, v3, vec); + return len; } void print_qt(const char *str, const float q[4]) |