diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-11 06:23:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-11 06:23:45 +0400 |
commit | b77acc287988c30897a92c0940c3442050456354 (patch) | |
tree | 0d79ade1b1b6187fbbbb5dbd18c816b5d1f5455c /source/blender/blenlib/intern/math_vector_inline.c | |
parent | e2a37db1d1c3a38b203159fdd5c0260ff6583d81 (diff) |
add 2d length functions for testing pixel coords. len_manhattan_v2_int, len_manhattan_v2v2_int
Diffstat (limited to 'source/blender/blenlib/intern/math_vector_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index cce78b5e5d2..216057f79c5 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -594,6 +594,11 @@ MINLINE float len_manhattan_v2(const float v[2]) return fabsf(v[0]) + fabsf(v[1]); } +MINLINE float len_manhattan_v2_int(const int v[2]) +{ + return ABS(v[0]) + ABS(v[1]); +} + MINLINE float len_manhattan_v3(const float v[3]) { return fabsf(v[0]) + fabsf(v[1]) + fabsf(v[2]); @@ -642,6 +647,14 @@ MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) return len_manhattan_v2(d); } +MINLINE float len_manhattan_v2v2_int(const int a[2], const int b[2]) +{ + int d[2]; + + sub_v2_v2v2_int(d, b, a); + return len_manhattan_v2_int(d); +} + MINLINE float len_manhattan_v3v3(const float a[3], const float b[3]) { float d[3]; |