diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-09 12:16:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-09 12:16:04 +0300 |
commit | d31ebbe66681cda8e94c6593e4b40c4b4df5809c (patch) | |
tree | dbfe940f8cbde15efa5545a21d33c0dbeae91516 /source/blender/blenlib | |
parent | ca89269c227607923bcfd8c137c552bdb0c37c16 (diff) |
cleanup for mathutils multiplication functions, a little faster in some cases, raise more informative exceptions.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 5f6251bf382..43cf612c33c 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -175,6 +175,8 @@ void range_vni(int *array, const int size, const int start); void mul_vn_fl(float *array, const int size, const float f); void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f); void add_vn_vn(float *array_tar, const float *array_src, const int size); +void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size); +void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size); void fill_vni(int *array_tar, const int size, const int val); void fill_vn(float *array_tar, const int size, const float val); diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 2ff1e948317..539d3fb97f6 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -398,6 +398,24 @@ void add_vn_vn(float *array_tar, const float *array_src, const int size) while(i--) { *(tar--) += *(src--); } } +void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size) +{ + float *tar= array_tar + (size-1); + const float *src_a= array_src_a + (size-1); + const float *src_b= array_src_b + (size-1); + int i= size; + while(i--) { *(tar--) = *(src_a--) + *(src_b--); } +} + +void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size) +{ + float *tar= array_tar + (size-1); + const float *src_a= array_src_a + (size-1); + const float *src_b= array_src_b + (size-1); + int i= size; + while(i--) { *(tar--) = *(src_a--) - *(src_b--); } +} + void fill_vni(int *array_tar, const int size, const int val) { int *tar= array_tar + (size-1); |