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>2015-12-17 10:06:05 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-12-17 10:06:05 +0300
commitb6a49eb9498e5025bd7920f620bae1a44f34104e (patch)
tree91e017e2d5c9c706f6c46f06bc482e79bea8b20b /source/blender/bmesh/intern/bmesh_queries.c
parentd7723df8466a9aa34ab51f5c3640ae17d48637eb (diff)
BMesh: add BM_face_share_vert_check/count
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_queries.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index e7a93c6aad5..f8cc66fc0df 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -1216,6 +1216,43 @@ bool BM_face_share_edge_check(BMFace *f1, BMFace *f2)
}
/**
+ * Counts the number of verts two faces share (if any).
+ */
+int BM_face_share_vert_count(BMFace *f_a, BMFace *f_b)
+{
+ BMLoop *l_iter;
+ BMLoop *l_first;
+ int count = 0;
+
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f_a);
+ do {
+ if (BM_vert_in_face(l_iter->v, f_b)) {
+ count++;
+ }
+ } while ((l_iter = l_iter->next) != l_first);
+
+ return count;
+}
+
+/**
+ * Returns true if the faces share a vert.
+ */
+bool BM_face_share_vert_check(BMFace *f_a, BMFace *f_b)
+{
+ BMLoop *l_iter;
+ BMLoop *l_first;
+
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f_a);
+ do {
+ if (BM_vert_in_face(l_iter->v, f_b)) {
+ return true;
+ }
+ } while ((l_iter = l_iter->next) != l_first);
+
+ return false;
+}
+
+/**
* Test if e1 shares any faces with e2
*/
bool BM_edge_share_face_check(BMEdge *e1, BMEdge *e2)