diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-04 10:12:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-04 10:12:58 +0300 |
commit | 0d69a5aa3491501c4a556aec3978128c041d328e (patch) | |
tree | 1a26cc1730348fb1323408be28f73511d3723e8d /source/blender/blenlib/intern/math_vector_inline.c | |
parent | 179358e6c479ee083dd70b56dc9206fd4a1e5206 (diff) | |
parent | 76b9eaf7a84ee2098c1ca1bf5cd4042c55ae76d7 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenlib/intern/math_vector_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index fcab001631e..dbb2339461f 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -1114,24 +1114,23 @@ MINLINE bool compare_v4v4_relative(const float v1[4], const float v2[4], const f MINLINE bool compare_len_v3v3(const float v1[3], const float v2[3], const float limit) { - float x, y, z; - - x = v1[0] - v2[0]; - y = v1[1] - v2[1]; - z = v1[2] - v2[2]; - - return ((x * x + y * y + z * z) <= (limit * limit)); + float d[3]; + sub_v3_v3v3(d, v1, v2); + return (dot_v3v3(d, d) <= (limit * limit)); } MINLINE bool compare_len_squared_v3v3(const float v1[3], const float v2[3], const float limit_sq) { - float x, y, z; - - x = v1[0] - v2[0]; - y = v1[1] - v2[1]; - z = v1[2] - v2[2]; + float d[3]; + sub_v3_v3v3(d, v1, v2); + return (dot_v3v3(d, d) <= limit_sq); +} - return ((x * x + y * y + z * z) <= limit_sq); +MINLINE bool compare_len_squared_v4v4(const float v1[4], const float v2[4], const float limit_sq) +{ + float d[4]; + sub_v4_v4v4(d, v1, v2); + return (dot_v4v4(d, d) <= limit_sq); } /** |