Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-02-11 00:27:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-02-11 00:27:28 +0300
commit4719836eca2e661ac79fbd1448fdc876b62af458 (patch)
treed3897a38e447c97faeee71f617ceeb24e7ab14c5
parent9274bd457a251961557d5a132e31a5b0159c540c (diff)
BLI_math: add mid_v2_v2v2v2
-rw-r--r--source/blender/blenlib/BLI_math_vector.h1
-rw-r--r--source/blender/blenlib/intern/math_vector.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 0bddff9101e..16585e34419 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -310,6 +310,7 @@ void interp_v4_v4v4_uchar(unsigned char target[4],
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_v2_v2v2v2(float v[2], const float v1[2], const float v2[2], const float v3[2]);
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_v3_array(float r[3], const float (*vec_arr)[3], const unsigned int nbr);
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 5f3297134c6..da16fb4a9fb 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -281,6 +281,12 @@ void mid_v2_v2v2(float r[2], const float a[2], const float b[2])
r[1] = 0.5f * (a[1] + b[1]);
}
+void mid_v2_v2v2v2(float v[2], const float v1[2], const float v2[2], const float v3[2])
+{
+ v[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
+ v[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
+}
+
void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3])
{
v[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;