Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-18 11:27:11 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-18 11:27:11 +0400
commit414370b8d42324878485e569fc332b814131887f (patch)
tree84b9b3077cccc3a5237bb8c033b6b39859cf9538 /source/blender/blenlib
parentbfdaa3b187b947a0efcf3a02cb70bbe8aff5e301 (diff)
Support for arbitrary sized vectors - (was limited by 2-4 previously)
patch http://codereview.appspot.com/5482043 from Andrew Hale * Text from the submission * This patch adds the ability to use arbitrary sized vectors from mathutils. Currently vectors are only of size 2, 3 or 4 since they are generally restricted to geometric applications. However, we can use arbitrary sized vectors for efficient calculations and data manipulation.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_vector.h1
-rw-r--r--source/blender/blenlib/intern/math_vector.c9
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 d8e880a9dec..e9e44ed7b2c 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -198,6 +198,7 @@ double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int s
float normalize_vn_vn(float *array_tar, const float *array_src, const int size);
float normalize_vn(float *array_tar, const int size);
void range_vn_i(int *array_tar, const int size, const int start);
+void range_vn_fl(float *array_tar, const int size, const float start, const float step);
void negate_vn(float *array_tar, const int size);
void negate_vn_vn(float *array_tar, const float *array_src, const int size);
void mul_vn_fl(float *array_tar, const int size, const float f);
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index a9ea90ef555..590a48e8085 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -416,6 +416,15 @@ void range_vn_i(int *array_tar, const int size, const int start)
while(i--) { *(array_pt--) = j--; }
}
+void range_vn_fl(float *array_tar, const int size, const float start, const float step)
+{
+ float *array_pt= array_tar + (size-1);
+ int i= size;
+ while(i--) {
+ *(array_pt--) = start + step * (float)(i);
+ }
+}
+
void negate_vn(float *array_tar, const int size)
{
float *array_pt= array_tar + (size-1);