diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-11 19:32:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-11 19:32:26 +0400 |
commit | e6b22d287f4742e4ccd6dd6a171370252ed5b5aa (patch) | |
tree | 182fb3fa4cba9cb42055003aee8a46a324df9ce5 /source/blender | |
parent | c098557240ec0b94e510e87ab6116356a1e90904 (diff) |
utility function for printing arbitrary sizes vectors.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 0df4de1f829..304e2ea7fde 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -240,6 +240,7 @@ void rotate_normalized_v3_v3v3fl(float v[3], const float p[3], const float axis[ void print_v2(const char *str, const float a[2]); void print_v3(const char *str, const float a[3]); void print_v4(const char *str, const float a[4]); +void print_vn(const char *str, const float v[], const int n); MINLINE void normal_short_to_float_v3(float r[3], const short n[3]); MINLINE void normal_float_to_short_v3(short r[3], const float n[3]); diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 78266c47170..8c653b7057a 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -542,6 +542,16 @@ void print_v4(const char *str, const float v[4]) printf("%s: %.3f %.3f %.3f %.3f\n", str, v[0], v[1], v[2], v[3]); } +void print_vn(const char *str, const float v[], const int n) +{ + int i = 0; + printf("%s[%d]:", str, n); + while (i++ < n) { + printf(" %.3f", v[i]); + } + printf("\n"); +} + void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]) { if (min[0] > vec[0]) min[0] = vec[0]; |