diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-02-05 16:00:58 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-02-05 16:00:58 +0300 |
commit | e442b9916eefaea9f98c126e2390b5aafa4518cc (patch) | |
tree | 03b88b5ad0572e4de86ddc2cbe4be35a5f1930b4 /source/blender | |
parent | 25f33e058a7b57d4f5964609b29b3f0834b3e6b6 (diff) |
BLI_math vectors: add minmax_v3v3_v3_array to get min and max values on each components of an array of 3D vectors.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 4455e72cf45..0f437b7fc38 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -290,6 +290,8 @@ 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]); void minmax_v2v2_v2(float min[2], float max[2], const float vec[2]); +void minmax_v3v3_v3_array(float r_min[3], float r_max[3], float (*vec_arr)[3], int nbr); + void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist); void dist_ensure_v2_v2fl(float v1[2], const float v2[2], const float dist); diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 887ec7d4d2c..d065fa7e5a7 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -757,6 +757,13 @@ void minmax_v2v2_v2(float min[2], float max[2], const float vec[2]) if (max[1] < vec[1]) max[1] = vec[1]; } +void minmax_v3v3_v3_array(float r_min[3], float r_max[3], float (*vec_arr)[3], int nbr) +{ + while (nbr--) { + minmax_v3v3_v3(r_min, r_max, *vec_arr++); + } +} + /** ensure \a v1 is \a dist from \a v2 */ void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist) { |