diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-20 13:18:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-20 13:18:55 +0400 |
commit | a044486d7d8faf3acc32d7c1d6dbf505c03e3631 (patch) | |
tree | b329a5de607c5aff7ae60e202347a0eefb025d5d /source/blender/blenlib | |
parent | c2aa5d6dc01dbc42ef9815bdbe8917b6164bf840 (diff) |
[#24267] Hook fails after Solidify
Solidify modifier wasn't assigning origindex values.
- BLI_math.h array functions: range_vni(), mul_vn_fl(), mul_vn_vn_fl(), add_vn_vn(), fill_vni().
- define 'AT' as __FILE__ ":" STRINGIFY(__LINE__), useful for quick debug prints.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 40 |
2 files changed, 48 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 5c17ac6b639..93d463e17ea 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -165,6 +165,14 @@ MINLINE void normal_float_to_short_v3(short r[3], const float n[3]); void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]); +/***************************** Array Functions *******************************/ +/* attempted to follow fixed length vertex functions. names could be improved*/ +void range_vni(int *array, const int size, const int start); +void mul_vn_fl(float *array, int size, const float f); +void mul_vn_vn_fl(float *array_tar, const float *array_src, int size, const float f); +void add_vn_vn(float *array_tar, const float *array_src, const int size); +void fill_vni(int *array_tar, const int size, const int val); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index e3cb5b37470..35476a8aba9 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -354,3 +354,43 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]) if(max[2]<vec[2]) max[2]= vec[2]; } + +/***************************** Array Functions *******************************/ + +void range_vni(int *array_tar, const int size, const int start) +{ + int *array_pt= array_tar + (size-1); + int j= start + (size-1); + int i= size; + while(i--) { *(array_pt--) = j--; } +} + +void mul_vn_fl(float *array_tar, const int size, const float f) +{ + float *array_pt= array_tar + (size-1); + int i= size; + while(i--) { *(array_pt--) *= f; } +} + +void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f) +{ + float *tar= array_tar + (size-1); + const float *src= array_src + (size-1); + int i= size; + while(i--) { *(tar--) = *(src--) * f; } +} + +void add_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 fill_vni(int *array_tar, const int size, const int val) +{ + int *tar= array_tar + (size-1); + int i= size; + while(i--) { *(tar--) = val; } +} |