diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-19 05:02:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-19 05:02:58 +0400 |
commit | 34f993241840120c1847410756cb2bf8af1be119 (patch) | |
tree | 5af1464868f7ee20b53cc5b4336af5721d004db2 /source/blender/bmesh/intern/bmesh_queries.c | |
parent | f2f27bf8325432ec8995f16385c7d65ef975eee1 (diff) |
simple optimization, replace BM_face_other_edge_loop() with BM_loop_other_edge_loop() in situations where the loop is known this avoids a lookup.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_queries.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index c0db2c0a19e..f61c63ee6c5 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -63,23 +63,24 @@ bool BM_vert_in_edge(const BMEdge *e, const BMVert *v) * in the face to check. * The faces loop direction is ignored. * </pre> + * + * \note caller must ensure \a e is used in \a f */ BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v) { - BMLoop *l_iter; - BMLoop *l_first; - - /* we could loop around the face too, but turns out this uses a lot - * more iterations (approx double with quads, many more with 5+ ngons) */ - l_iter = l_first = e->l; + BMLoop *l = BM_face_edge_share_loop(f, e); + BLI_assert(l != NULL); + return BM_loop_other_edge_loop(l, v); +} - do { - if (l_iter->e == e && l_iter->f == f) { - break; - } - } while ((l_iter = l_iter->radial_next) != l_first); - - return l_iter->v == v ? l_iter->prev : l_iter->next; +/** + * See #BM_face_other_edge_loop This is the same functionality + * to be used when the edges loop is already known. + */ +BMLoop *BM_loop_other_edge_loop(BMLoop *l, BMVert *v) +{ + BLI_assert(BM_vert_in_edge(l->e, v)); + return l->v == v ? l->prev : l->next; } /** |