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:
authorDalai Felinto <dfelinto@gmail.com>2017-01-11 11:44:25 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-01-11 11:44:25 +0300
commit77dcf0fbc51afffb0d359dfaae4c30f864565522 (patch)
treeff662fa8d458fab0ba9413964c3dfded1f978d18 /source/blender/blenlib
parent80865bd583c28fcad9cc6ef8dc7185aaccf0ed50 (diff)
parente041bf757944efee55a4a8bdc599c12bb8829863 (diff)
Merge remote-tracking branch 'origin/master' into blender2.8
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_geom.h3
-rw-r--r--source/blender/blenlib/BLI_math_vector.h1
-rw-r--r--source/blender/blenlib/intern/math_geom.c14
-rw-r--r--source/blender/blenlib/intern/math_vector.c10
4 files changed, 11 insertions, 17 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 514b0300274..b5007b29f4c 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -44,9 +44,6 @@ extern "C" {
/********************************** Polygons *********************************/
-void cent_tri_v3(float r[3], const float a[3], const float b[3], const float c[3]);
-void cent_quad_v3(float r[3], const float a[3], const float b[3], const float c[3], const float d[3]);
-
float normal_tri_v3(float r[3], const float a[3], const float b[3], const float c[3]);
float normal_quad_v3(float r[3], const float a[3], const float b[3], const float c[3], const float d[3]);
float normal_poly_v3(float r[3], const float verts[][3], unsigned int nr);
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index f5beda0f13e..2bf3747c41d 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -234,6 +234,7 @@ 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_v3_array(float r[3], const float (*vec_arr)[3], const unsigned int nbr);
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_geom.c b/source/blender/blenlib/intern/math_geom.c
index 46d963ee268..76dac5487f2 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -37,20 +37,6 @@
/********************************** Polygons *********************************/
-void cent_tri_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3])
-{
- cent[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
- cent[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
- cent[2] = (v1[2] + v2[2] + v3[2]) / 3.0f;
-}
-
-void cent_quad_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
-{
- cent[0] = 0.25f * (v1[0] + v2[0] + v3[0] + v4[0]);
- cent[1] = 0.25f * (v1[1] + v2[1] + v3[1] + v4[1]);
- cent[2] = 0.25f * (v1[2] + v2[2] + v3[2] + v4[2]);
-}
-
void cross_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
{
float n1[3], n2[3];
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 90e39da5d46..500c6e57923 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -280,6 +280,16 @@ void mid_v3_v3v3v3v3(float v[3], const float v1[3], const float v2[3], const flo
v[2] = (v1[2] + v2[2] + v3[2] + v4[2]) / 4.0f;
}
+void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], const unsigned int nbr)
+{
+ const float factor = 1.0f / (float)nbr;
+ zero_v3(r);
+
+ for (unsigned int i = 0; i < nbr; i++) {
+ madd_v3_v3fl(r, vec_arr[i], factor);
+ }
+}
+
/**
* Specialized function for calculating normals.
* fastpath for: