From f14df2977750531956d0048576a27b58ca5ea571 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 May 2014 14:56:17 +1000 Subject: BMesh: make BM_face_calc_normal_subset apart of the bmesh api also make face normal calculation functions return normal length --- .../bmesh/operators/bmo_connect_nonplanar.c | 27 ++-------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'source/blender/bmesh/operators') 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 @@ -38,29 +38,6 @@ #define EDGE_OUT (1 << 0) #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. */ @@ -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); -- cgit v1.2.3