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>2014-05-13 08:56:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-13 08:58:05 +0400
commitf14df2977750531956d0048576a27b58ca5ea571 (patch)
tree31063cbc7f8da9d0d6cdc4ba92569788c2ae6364 /source/blender/bmesh/operators
parent51fa66bc64c8b14af104817994c613217cfc18cc (diff)
BMesh: make BM_face_calc_normal_subset apart of the bmesh api
also make face normal calculation functions return normal length
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r--source/blender/bmesh/operators/bmo_connect_nonplanar.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/source/blender/bmesh/operators/bmo_connect_nonplanar.c b/source/blender/bmesh/operators/bmo_connect_nonplanar.c
index 15447c97b5f..9e9f1cbf0d4 100644
--- a/source/blender/bmesh/operators/bmo_connect_nonplanar.c
+++ b/source/blender/bmesh/operators/bmo_connect_nonplanar.c
@@ -39,29 +39,6 @@
#define FACE_OUT (1 << 1)
/**
- * Calculates the face subset normal.
- */
-static bool bm_face_subset_calc_normal(BMLoop *l_first, BMLoop *l_last, float r_no[3])
-{
- const float *v_prev, *v_curr;
-
- /* Newell's Method */
- BMLoop *l_iter = l_first;
- BMLoop *l_term = l_last->next;
-
- zero_v3(r_no);
-
- v_prev = l_last->v->co;
- do {
- v_curr = l_iter->v->co;
- add_newell_cross_v3_v3v3(r_no, v_prev, v_curr);
- v_prev = v_curr;
- } while ((l_iter = l_iter->next) != l_term);
-
- return (normalize_v3(r_no) != 0.0f);
-}
-
-/**
* Calculates how non-planar the face subset is.
*/
static float bm_face_subset_calc_planar(BMLoop *l_first, BMLoop *l_last, const float no[3])
@@ -115,8 +92,8 @@ static bool bm_face_split_find(BMFace *f, BMLoop *l_pair[2], float *r_angle)
/* first calculate normals */
float no_a[3], no_b[3];
- if (bm_face_subset_calc_normal(l_a, l_b, no_a) &&
- bm_face_subset_calc_normal(l_b, l_a, no_b))
+ if (BM_face_calc_normal_subset(l_a, l_b, no_a) != 0.0f &&
+ BM_face_calc_normal_subset(l_b, l_a, no_b) != 0.0f)
{
const float err_a = bm_face_subset_calc_planar(l_a, l_b, no_a);
const float err_b = bm_face_subset_calc_planar(l_b, l_a, no_b);