diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-07-06 10:40:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-07-06 11:23:38 +0300 |
commit | b51b893df8623d35f657ffa3975ca9a7422b971d (patch) | |
tree | 1de54a399c81c36cc5e7deaf3bd25a3ae680d43b /source | |
parent | 705015e0a42c09ae503e42ebc592c9f04f097617 (diff) |
BMesh: add BM_loop_other_vert_loop_by_edge
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_query.c | 31 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_query.h | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c index fe67abf6aa5..80634618f6f 100644 --- a/source/blender/bmesh/intern/bmesh_query.c +++ b/source/blender/bmesh/intern/bmesh_query.c @@ -158,6 +158,37 @@ BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v) } /** + * Return the other loop that uses this edge. + * + * In this case the loop defines the vertex, + * the edge passed in defines the direction to step. + * + * <pre> + * +----------+ <-- Return the face-loop of this vertex. + * | | + * | e | <-- This edge defines the direction. + * | | + * +----------+ <-- This loop defines the face and vertex.. + * l + * </pre> + * + */ +BMLoop *BM_loop_other_vert_loop_by_edge(BMLoop *l, BMEdge *e) +{ + BLI_assert(BM_vert_in_edge(e, l->v)); + if (l->e == e) { + return l->next; + } + else if (l->prev->e == e) { + return l->prev; + } + else { + BLI_assert(0); + return NULL; + } +} + +/** * Check if verts share a face. */ bool BM_vert_pair_share_face_check(BMVert *v_a, BMVert *v_b) diff --git a/source/blender/bmesh/intern/bmesh_query.h b/source/blender/bmesh/intern/bmesh_query.h index 7e07059d4d8..31ab7e4095a 100644 --- a/source/blender/bmesh/intern/bmesh_query.h +++ b/source/blender/bmesh/intern/bmesh_query.h @@ -48,6 +48,8 @@ BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v) ATTR_WARN_UNUSE BMLoop *BM_loop_other_edge_loop(BMLoop *l, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +BMLoop *BM_loop_other_vert_loop_by_edge(BMLoop *l, BMEdge *e) ATTR_WARN_UNUSED_RESULT + ATTR_NONNULL(); BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); |