[Bf-blender-cvs] [e442b99] master: BLI_math vectors: add minmax_v3v3_v3_array to get min and max values on each components of an array of 3D vectors.
Bastien Montagne
noreply at git.blender.org
Thu Feb 5 14:09:02 CET 2015
Commit: e442b9916eefaea9f98c126e2390b5aafa4518cc
Author: Bastien Montagne
Date: Thu Feb 5 14:00:58 2015 +0100
Branches: master
https://developer.blender.org/rBe442b9916eefaea9f98c126e2390b5aafa4518cc
BLI_math vectors: add minmax_v3v3_v3_array to get min and max values on each components of an array of 3D vectors.
===================================================================
M source/blender/blenlib/BLI_math_vector.h
M source/blender/blenlib/intern/math_vector.c
===================================================================
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 4455e72..0f437b7 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 887ec7d..d065fa7 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)
{
More information about the Bf-blender-cvs
mailing list