diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-26 02:47:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-26 02:47:54 +0400 |
commit | b32bf2c462970912c2e8013fcf6f0ee5e3eaadd5 (patch) | |
tree | 1f676fef36a65b7f9f55ffbf63bf3f68e4a727e0 /source/blender/blenlib/intern/math_vector.c | |
parent | 2223ca1c20cf480ca77365ff3593066c655de9fa (diff) |
code cleanup: use min_/max_ math functions, add minmax_v2_v2v2.
Diffstat (limited to 'source/blender/blenlib/intern/math_vector.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 4196bab0474..7c9c5f60126 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -451,6 +451,15 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]) if (max[2] < vec[2]) max[2] = vec[2]; } +void minmax_v2v2_v2(float min[2], float max[2], const float vec[2]) +{ + if (min[0] > vec[0]) min[0] = vec[0]; + if (min[1] > vec[1]) min[1] = vec[1]; + + if (max[0] < vec[0]) max[0] = vec[0]; + if (max[1] < vec[1]) max[1] = vec[1]; +} + /** ensure \a v1 is \a dist from \a v2 */ void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist) { |