[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44581] trunk/blender/source/blender/bmesh /intern/bmesh_queries.c: fast-path for BM_edge_is_manifold, BM_edge_is_boundary functions.

Campbell Barton ideasman42 at gmail.com
Thu Mar 1 17:56:48 CET 2012


Revision: 44581
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44581
Author:   campbellbarton
Date:     2012-03-01 16:56:42 +0000 (Thu, 01 Mar 2012)
Log Message:
-----------
fast-path for BM_edge_is_manifold, BM_edge_is_boundary functions.

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/intern/bmesh_queries.c

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_queries.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_queries.c	2012-03-01 16:41:51 UTC (rev 44580)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_queries.c	2012-03-01 16:56:42 UTC (rev 44581)
@@ -348,27 +348,50 @@
  * 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)




More information about the Bf-blender-cvs mailing list