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>2013-02-03 10:09:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-02-03 10:09:29 +0400
commit1f21efdeac19d57b60554da920935a97d682b9b9 (patch)
tree60e33d59cc1abe8f4d51a6f9cf5a70ae55462a2f /source/blender/bmesh
parentf0d4b85feffb625efb406d3fba81b076a3a1fc4f (diff)
fix [#34073] Combined EdgeLoop slides weirdly on even try
concave check on co-linear edges could fail, avoid by using the loop-direction + face normal.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c23
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index bf30db78a61..b2b710a0d36 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -1058,6 +1058,29 @@ void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3])
}
/**
+ * \brief BM_loop_calc_face_direction
+ *
+ * Calculate the direction a loop is pointing.
+ *
+ * \param l The loop to calculate the direction at
+ * \param r_dir Resulting direction
+ */
+void BM_loop_calc_face_direction(BMLoop *l, float r_dir[3])
+{
+ float v_prev[3];
+ float v_next[3];
+
+ sub_v3_v3v3(v_prev, l->v->co, l->prev->v->co);
+ sub_v3_v3v3(v_next, l->next->v->co, l->v->co);
+
+ normalize_v3(v_prev);
+ normalize_v3(v_next);
+
+ add_v3_v3v3(r_dir, v_prev, v_next);
+ normalize_v3(r_dir);
+}
+
+/**
* \brief BM_loop_calc_face_tangent
*
* Calculate the tangent at this loop corner or fallback to the face normal on straight lines.
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
index 4172b3905cd..b285c531bb5 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -66,6 +66,7 @@ bool BM_loop_is_convex(BMLoop *l);
float BM_loop_calc_face_angle(BMLoop *l);
void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3]);
+void BM_loop_calc_face_direction(BMLoop *l, float r_normal[3]);
void BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3]);
float BM_edge_calc_face_angle(BMEdge *e);