diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-01 20:56:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-01 20:56:42 +0400 |
commit | e89f09a77474a8384f4e7cf0809ea975d367b24e (patch) | |
tree | 7f8033b3946ce1196b639267520d6894261523db /source | |
parent | 93249c35b134955728ff5c49d7c765086ff47de8 (diff) |
fast-path for BM_edge_is_manifold, BM_edge_is_boundary functions.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index 28c370f51eb..7338da927ac 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -348,27 +348,50 @@ int BM_vert_is_manifold(BMesh *UNUSED(bm), BMVert *v) * Tests whether or not this edge is manifold. * A manifold edge either has 1 or 2 faces attached to it. */ + +#if 1 /* fast path for checking manifold */ +int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e) +{ + const BMLoop *l = e->l; + return (l && ((l->radial_next == l) || /* 1 face user */ + (l->radial_next->radial_next == l))); /* 2 face users */ +} +#else int BM_edge_is_manifold(BMesh *UNUSED(bm), BMEdge *e) { int count = BM_edge_face_count(e); - if (count != 2 && count != 1) { + if (count == 2 || count == 1) { + return TRUE; + } + else { return FALSE; } - return TRUE; } +#endif /** * Tests whether or not an edge is on the boundary * of a shell (has one face associated with it) */ + +#if 1 /* fast path for checking boundry */ +int BM_edge_is_boundary(BMEdge *e) +{ + const BMLoop *l = e->l; + return (l && (l->radial_next == l)); +} +#else int BM_edge_is_boundary(BMEdge *e) { int count = BM_edge_face_count(e); if (count == 1) { return TRUE; } - return FALSE; + else { + return FALSE; + } } +#endif /** * Counts the number of edges two faces share (if any) |