[Bf-blender-cvs] [63a2cc2] master: BMesh API: make simple, low level functions inline

Campbell Barton noreply at git.blender.org
Mon Dec 23 06:59:30 CET 2013


Commit: 63a2cc2ab76794f5645f5b9289199ac9b1a8974c
Author: Campbell Barton
Date:   Mon Dec 23 16:03:07 2013 +1100
http://developer.blender.org/rB63a2cc2ab76794f5645f5b9289199ac9b1a8974c

BMesh API: make simple, low level functions inline

===================================================================

M	source/blender/bmesh/CMakeLists.txt
M	source/blender/bmesh/intern/bmesh_core.c
M	source/blender/bmesh/intern/bmesh_mods.c
M	source/blender/bmesh/intern/bmesh_queries.c
M	source/blender/bmesh/intern/bmesh_queries.h
A	source/blender/bmesh/intern/bmesh_queries_inline.h
M	source/blender/bmesh/intern/bmesh_structure.c
M	source/blender/bmesh/intern/bmesh_structure.h
A	source/blender/bmesh/intern/bmesh_structure_inline.h

===================================================================

diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index cd8d71b..8d87e29 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -108,8 +108,10 @@ set(SRC
 	intern/bmesh_private.h
 	intern/bmesh_queries.c
 	intern/bmesh_queries.h
+	intern/bmesh_queries_inline.h
 	intern/bmesh_structure.c
 	intern/bmesh_structure.h
+	intern/bmesh_structure_inline.h
 	intern/bmesh_walkers.c
 	intern/bmesh_walkers.h
 	intern/bmesh_walkers_impl.c
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index a270830..cbaffe2 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -862,7 +862,7 @@ static bool bm_loop_reverse_loop(BMesh *bm, BMFace *f
 		for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) {
 			edok = 0;
 			for (j = 0; j < len; j++) {
-				edok = bmesh_verts_in_edge(l_iter->v, l_iter->next->v, edar[j]);
+				edok = BM_verts_in_edge(l_iter->v, l_iter->next->v, edar[j]);
 				if (edok) {
 					l_iter->e = edar[j];
 					break;
@@ -1424,9 +1424,9 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
 	int i;
 #endif
 
-	BLI_assert(bmesh_vert_in_edge(e, tv) != false);
+	BLI_assert(BM_vert_in_edge(e, tv) != false);
 
-	v_old = bmesh_edge_other_vert_get(e, tv);
+	v_old = BM_edge_other_vert(e, tv);
 
 #ifndef NDEBUG
 	valence1 = bmesh_disk_count(v_old);
@@ -1489,7 +1489,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
 			l_new->v = v_new;
 
 			/* assign the correct edge to the correct loop */
-			if (bmesh_verts_in_edge(l_new->v, l_new->next->v, e)) {
+			if (BM_verts_in_edge(l_new->v, l_new->next->v, e)) {
 				l_new->e = e;
 				l->e = e_new;
 
@@ -1507,7 +1507,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
 				bmesh_radial_append(l_new->e, l_new);
 				bmesh_radial_append(l->e, l);
 			}
-			else if (bmesh_verts_in_edge(l_new->v, l_new->next->v, e_new)) {
+			else if (BM_verts_in_edge(l_new->v, l_new->next->v, e_new)) {
 				l_new->e = e_new;
 				l->e = e;
 
@@ -1541,7 +1541,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
 			//BMESH_ASSERT(l->radial_next == l);
 			BMESH_ASSERT(!(l->prev->e != e_new && l->next->e != e_new));
 
-			edok = bmesh_verts_in_edge(l->v, l->next->v, e);
+			edok = BM_verts_in_edge(l->v, l->next->v, e);
 			BMESH_ASSERT(edok != false);
 			BMESH_ASSERT(l->v != l->next->v);
 			BMESH_ASSERT(l->e != l->next->e);
@@ -1557,7 +1557,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
 			BMESH_ASSERT(l->e == e_new);
 			// BMESH_ASSERT(l->radial_next == l);
 			BMESH_ASSERT(!(l->prev->e != e && l->next->e != e));
-			edok = bmesh_verts_in_edge(l->v, l->next->v, e_new);
+			edok = BM_verts_in_edge(l->v, l->next->v, e_new);
 			BMESH_ASSERT(edok != false);
 			BMESH_ASSERT(l->v != l->next->v);
 			BMESH_ASSERT(l->e != l->next->e);
@@ -1619,7 +1619,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool check_e
 	int len, radlen = 0, i;
 	bool edok, halt = false;
 
-	if (bmesh_vert_in_edge(e_kill, v_kill) == 0) {
+	if (BM_vert_in_edge(e_kill, v_kill) == 0) {
 		return NULL;
 	}
 
@@ -1632,9 +1632,9 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool check_e
 #endif
 
 		e_old = bmesh_disk_edge_next(e_kill, v_kill);
-		tv = bmesh_edge_other_vert_get(e_kill, v_kill);
-		v_old = bmesh_edge_other_vert_get(e_old, v_kill);
-		halt = bmesh_verts_in_edge(v_kill, tv, e_old); /* check for double edges */
+		tv = BM_edge_other_vert(e_kill, v_kill);
+		v_old = BM_edge_other_vert(e_old, v_kill);
+		halt = BM_verts_in_edge(v_kill, tv, e_old); /* check for double edges */
 		
 		if (halt) {
 			return NULL;
@@ -1722,7 +1722,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool check_e
 			/* Validate loop cycle of all faces attached to 'e_old' */
 			for (i = 0, l = e_old->l; i < radlen; i++, l = l->radial_next) {
 				BMESH_ASSERT(l->e == e_old);
-				edok = bmesh_verts_in_edge(l->v, l->next->v, e_old);
+				edok = BM_verts_in_edge(l->v, l->next->v, e_old);
 				BMESH_ASSERT(edok != false);
 				edok = bmesh_loop_validate(l->f);
 				BMESH_ASSERT(edok != false);
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index 4dc155e..49c8c98 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -461,7 +461,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float
                                const bool join_faces, const bool kill_degenerate_faces)
 {
 	BMEdge *e_new = NULL;
-	BMVert *tv = bmesh_edge_other_vert_get(e_kill, v_kill);
+	BMVert *tv = BM_edge_other_vert(e_kill, v_kill);
 
 	BMEdge *e2;
 	BMVert *tv2;
@@ -575,7 +575,7 @@ BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
 
 	/* in this case we want to keep all faces and not join them,
 	 * rather just get rid of the vertex - see bug [#28645] */
-	BMVert *tv  = bmesh_edge_other_vert_get(e_kill, v_kill);
+	BMVert *tv  = BM_edge_other_vert(e_kill, v_kill);
 	if (tv) {
 		BMEdge *e2 = bmesh_disk_edge_next(e_kill, v_kill);
 		if (e2) {
@@ -642,7 +642,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce
 		}
 	}
 
-	v2 = bmesh_edge_other_vert_get(e, v);
+	v2 = BM_edge_other_vert(e, v);
 	v_new = bmesh_semv(bm, v, e, r_e);
 
 	BLI_assert(v_new != NULL);
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index c655fe4..15e564b 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -41,15 +41,6 @@
 #include "intern/bmesh_private.h"
 
 /**
- * Returns whether or not a given vertex is
- * is part of a given edge.
- */
-bool BM_vert_in_edge(const BMEdge *e, const BMVert *v)
-{
-	return bmesh_vert_in_edge(e, v);
-}
-
-/**
  * \brief Other Loop in Face Sharing an Edge
  *
  * Finds the other loop that shares \a v with \a e loop in \a f.
@@ -354,32 +345,6 @@ bool BM_edge_in_face(BMEdge *e, BMFace *f)
 }
 
 /**
- * Returns whether or not a given edge is is part of a given loop.
- */
-bool BM_edge_in_loop(BMEdge *e, BMLoop *l)
-{
-	return (l->e == e || l->prev->e == e);
-}
-
-/**
- * Returns whether or not two vertices are in
- * a given edge
- */
-bool BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
-{
-	return bmesh_verts_in_edge(v1, v2, e);
-}
-
-/**
- * Given a edge and one of its vertices, returns
- * the other vertex.
- */
-BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v)
-{
-	return bmesh_edge_other_vert_get(e, v);
-}
-
-/**
  * Given a edge and a loop (assumes the edge is manifold). returns
  * the other faces loop, sharing the same vertex.
  *
@@ -665,15 +630,6 @@ bool BM_vert_is_wire(const BMVert *v)
 }
 
 /**
- * Tests whether or not the edge is part of a wire.
- * (ie: has no faces attached to it)
- */
-bool BM_edge_is_wire(const BMEdge *e)
-{
-	return (e->l == NULL);
-}
-
-/**
  * A vertex is non-manifold if it meets the following conditions:
  * 1: Loose - (has no edges/faces incident upon it).
  * 2: Joins two distinct regions - (two pyramids joined at the tip).
@@ -740,44 +696,6 @@ bool BM_vert_is_manifold(const BMVert *v)
 }
 
 /**
- * Tests whether or not this edge is manifold.
- * A manifold edge has exactly 2 faces attached to it.
- */
-
-#if 1 /* fast path for checking manifold */
-bool BM_edge_is_manifold(const BMEdge *e)
-{
-	const BMLoop *l = e->l;
-	return (l && (l->radial_next != l) &&             /* not 0 or 1 face users */
-	             (l->radial_next->radial_next == l)); /* 2 face users */
-}
-#else
-int BM_edge_is_manifold(BMEdge *e)
-{
-	int count = BM_edge_face_count(e);
-	if (count == 2) {
-		return true;
-	}
-	else {
-		return false;
-	}
-}
-#endif
-
-/**
- * Tests that the edge is manifold and
- * that both its faces point the same way.
- */
-bool BM_edge_is_contiguous(const BMEdge *e)
-{
-	const BMLoop *l = e->l;
-	const BMLoop *l_other;
-	return (l && ((l_other = l->radial_next) != l) &&  /* not 0 or 1 face users */
-	             (l_other->radial_next == l) &&        /* 2 face users */
-	             (l_other->v != l->v));
-}
-
-/**
  * Check if the edge is convex or concave
  * (depends on face winding)
  */
@@ -798,30 +716,6 @@ bool BM_edge_is_convex(const BMEdge *e)
 	return true;
 }
 
-/**
- * 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 boundary */
-bool BM_edge_is_boundary(const 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;
-	}
-	else {
-		return false;
-	}
-}
-#endif
-
 bool BM_vert_is_boundary(const BMVert *v)
 {
 	if (v->e) {
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
index ab20b1c..17c1431 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -32,16 +32,16 @@ int     BM_verts_in_face_count(BMFace *f, BMVert **varr, int len);
 bool    BM_verts_in_face(BMFace *f, BMVert **varr, int len);
 
 bool    BM_edge_in_face(BMEdge *e, BMFace *f);
-bool    BM_edge_in_loop(BMEdge *e, BMLoop *l);
+BLI_INLINE bool    BM_edge_in_loop(const BMEdge *e, const BMLoop *l);
 
-bool    BM_vert_in_edge(const BMEdge *e, const BMVert *v);
-bool    BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
+BLI_INLINE bool    BM_vert_in_edge(const BMEdge *e, const BMVert *v);
+BLI_INLINE bool    BM_verts_in_edge(const BMVert *v1, const BMVert *v2, const BMEdge *e);
 
 float   BM_edge_calc_length(BMEdge *e);
 float   BM_edge_calc_length_squared(BMEdge *e);
 bool    BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb);
 bool    BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb);
-BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v);
+BLI_INLINE BMVert *BM_edge_other_vert(BMEdge *e, const BMVert *v);
 BMLoop *BM_edge_other_loop(BMEdge *e, BMLoop *l);
 BMLoop *BM_face_other_edge_loop(BMFace *f, BM

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list