diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-28 08:02:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-28 08:02:57 +0400 |
commit | 5981567ec6afb3ae95f24c28b2c72bff0d8e01e6 (patch) | |
tree | 6de07252b408ae2f417dc751be550b40c2e856a1 /source/blender/blenlib | |
parent | 7199e2288f3df27ee2d21593da64ef4597fb86fd (diff) |
Code cleanup: use len_v2v2_int for view zoom-scale
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index aef06f77d72..9b73ca553d6 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -163,6 +163,7 @@ MINLINE int len_manhattan_v2_int(const int v[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_manhattan_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; +MINLINE float len_v2v2_int(const int v1[2], const int v2[2]); MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 45a0cb3f8e2..59d5f7e7627 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -676,6 +676,15 @@ MINLINE float len_v2v2(const float v1[2], const float v2[2]) return sqrtf(x * x + y * y); } +MINLINE float len_v2v2_int(const int v1[2], const int v2[2]) +{ + float x, y; + + x = (float)(v1[0] - v2[0]); + y = (float)(v1[1] - v2[1]); + return sqrtf(x * x + y * y); +} + MINLINE float len_v3(const float a[3]) { return sqrtf(dot_v3v3(a, a)); |