diff options
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 13 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index d35625566c0..d478ac07474 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -659,6 +659,19 @@ bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb) } /** + * Fast alternative to ``(BM_vert_edge_count(v) == 2)`` + */ +bool BM_vert_is_edge_pair(BMVert *v) +{ + BMEdge *e = v->e; + if (e) { + const BMDiskLink *dl = bmesh_disk_edge_link_from_vert(e, v); + return (dl->next == dl->prev); + } + return false; +} + +/** * Returns the number of edges around this vertex. */ int BM_vert_edge_count(BMVert *v) diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h index 7db04a529eb..21d20976901 100644 --- a/source/blender/bmesh/intern/bmesh_queries.h +++ b/source/blender/bmesh/intern/bmesh_queries.h @@ -65,6 +65,7 @@ int BM_edge_face_count(BMEdge *e); int BM_vert_face_count(BMVert *v); BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e); +bool BM_vert_is_edge_pair(BMVert *v); bool BM_vert_is_wire(const BMVert *v); BLI_INLINE bool BM_edge_is_wire(const BMEdge *e); |