diff options
author | Andrew Hale <TrumanBlending@gmail.com> | 2018-08-09 01:10:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-08-09 01:14:38 +0300 |
commit | 3aee3bbac7317d205b611b9aa713791f17104556 (patch) | |
tree | 5084f0ba63af78eb0c9da49d4f8f84ed25e7f01d /source/blender/blenlib/intern/math_vector.c | |
parent | 440ef4235ff0b7a67de978d790bf923c04badabe (diff) |
Math Lib: varied size vector multiply
Needed for Python mathutils elementwise multiply.
Diffstat (limited to 'source/blender/blenlib/intern/math_vector.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index d6e48fa59e7..acb4ee87f69 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -1096,6 +1096,27 @@ void negate_vn_vn(float *array_tar, const float *array_src, const int size) } } +void mul_vn_vn(float *array_tar, const float *array_src, const int size) +{ + float *tar = array_tar + (size - 1); + const float *src = array_src + (size - 1); + int i = size; + while (i--) { + *(tar--) *= *(src--); + } +} + +void mul_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 mul_vn_fl(float *array_tar, const int size, const float f) { float *array_pt = array_tar + (size - 1); |