diff options
-rw-r--r-- | source/blender/bmesh/intern/bmesh_structure.c | 25 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_structure.h | 1 |
2 files changed, 23 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c index d8313dab36f..3e8002c0192 100644 --- a/source/blender/bmesh/intern/bmesh_structure.c +++ b/source/blender/bmesh/intern/bmesh_structure.c @@ -108,6 +108,7 @@ bool bmesh_edge_swapverts(BMEdge *e, BMVert *v_orig, BMVert *v_new) * - #bmesh_radial_append * - #bmesh_radial_loop_remove * - #bmesh_radial_facevert_count + * - #bmesh_radial_facevert_check * - #bmesh_radial_faceloop_find_first * - #bmesh_radial_faceloop_find_next * - #bmesh_radial_validate @@ -265,7 +266,7 @@ BMEdge *bmesh_disk_faceedge_find_first(const BMEdge *e, const BMVert *v) { const BMEdge *e_find = e; do { - if (e_find->l && bmesh_radial_facevert_count(e_find->l, v)) { + if (e_find->l && bmesh_radial_facevert_check(e_find->l, v)) { return (BMEdge *)e_find; } } while ((e_find = bmesh_disk_edge_next(e_find, v)) != e); @@ -275,10 +276,10 @@ BMEdge *bmesh_disk_faceedge_find_first(const BMEdge *e, const BMVert *v) BMEdge *bmesh_disk_faceedge_find_next(const BMEdge *e, const BMVert *v) { - BMEdge *e_find = NULL; + BMEdge *e_find; e_find = bmesh_disk_edge_next(e, v); do { - if (e_find->l && bmesh_radial_facevert_count(e_find->l, v)) { + if (e_find->l && bmesh_radial_facevert_check(e_find->l, v)) { return e_find; } } while ((e_find = bmesh_disk_edge_next(e_find, v)) != e); @@ -455,6 +456,24 @@ int bmesh_radial_facevert_count(const BMLoop *l, const BMVert *v) return count; } +/** + * \brief RADIAL CHECK FACE VERT + * + * Quicker check for ``bmesh_radial_facevert_count(...) != 0`` + */ +bool bmesh_radial_facevert_check(const BMLoop *l, const BMVert *v) +{ + const BMLoop *l_iter; + l_iter = l; + do { + if (l_iter->v == v) { + return true; + } + } while ((l_iter = l_iter->radial_next) != l); + + return false; +} + /*****loop cycle functions, e.g. loops surrounding a face**** */ bool bmesh_loop_validate(BMFace *f) { diff --git a/source/blender/bmesh/intern/bmesh_structure.h b/source/blender/bmesh/intern/bmesh_structure.h index d2ad655ae75..29868194bbf 100644 --- a/source/blender/bmesh/intern/bmesh_structure.h +++ b/source/blender/bmesh/intern/bmesh_structure.h @@ -61,6 +61,7 @@ void bmesh_radial_loop_remove(BMLoop *l, BMEdge *e) ATTR_NONNULL(1); * just use member access l->radial_next, l->radial_prev now */ int bmesh_radial_facevert_count(const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +bool bmesh_radial_facevert_check(const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BMLoop *bmesh_radial_faceloop_find_first(const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BMLoop *bmesh_radial_faceloop_find_next(const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BMLoop *bmesh_radial_faceloop_find_vert(const BMFace *f, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); |