[Bf-blender-cvs] [9ffc66b] master: Math Lib: add mid_v3_v3v3v3v3

Campbell Barton noreply at git.blender.org
Mon Mar 9 10:26:54 CET 2015


Commit: 9ffc66b1c0e33b107193af38c71efb86c714dc5b
Author: Campbell Barton
Date:   Mon Mar 9 20:20:39 2015 +1100
Branches: master
https://developer.blender.org/rB9ffc66b1c0e33b107193af38c71efb86c714dc5b

Math Lib: add mid_v3_v3v3v3v3

===================================================================

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 33319f3..ffd80f4 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -208,6 +208,7 @@ void interp_v4_v4v4_uchar(unsigned char target[4], const unsigned char a[4], con
 void mid_v3_v3v3(float r[3], const float a[3], const float b[3]);
 void mid_v2_v2v2(float r[2], const float a[2], const float b[2]);
 void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3]);
+void mid_v3_v3v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
 
 void mid_v3_v3v3_angle_weighted(float r[3], const float a[3], const float b[3]);
 void mid_v3_angle_weighted(float r[3]);
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 1658c4f..814180b 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -252,6 +252,13 @@ void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float
 	v[2] = (v1[2] + v2[2] + v3[2]) / 3.0f;
 }
 
+void mid_v3_v3v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
+{
+	v[0] = (v1[0] + v2[0] + v3[0] + v4[0]) / 4.0f;
+	v[1] = (v1[1] + v2[1] + v3[1] + v4[1]) / 4.0f;
+	v[2] = (v1[2] + v2[2] + v3[2] + v4[2]) / 4.0f;
+}
+
 /**
  * Specialized function for calculating normals.
  * fastpath for:




More information about the Bf-blender-cvs mailing list