From 9ffc66b1c0e33b107193af38c71efb86c714dc5b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 9 Mar 2015 20:20:39 +1100 Subject: Math Lib: add mid_v3_v3v3v3v3 --- source/blender/blenlib/BLI_math_vector.h | 1 + source/blender/blenlib/intern/math_vector.c | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'source') diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 33319f36507..ffd80f46725 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 1658c4ffc39..814180bba24 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: -- cgit v1.2.3