[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51456] trunk/blender/source/blender/bmesh /intern: fix for BM_edge_other_loop() not working right ( own error in recent commit), and add new function BM_vert_step_fan_loop() for stepping around the loops of a face fan with manifold edges.
Campbell Barton
ideasman42 at gmail.com
Sat Oct 20 18:48:05 CEST 2012
Revision: 51456
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51456
Author: campbellbarton
Date: 2012-10-20 16:48:04 +0000 (Sat, 20 Oct 2012)
Log Message:
-----------
fix for BM_edge_other_loop() not working right (own error in recent commit), and add new function BM_vert_step_fan_loop() for stepping around the loops of a face fan with manifold edges.
Modified Paths:
--------------
trunk/blender/source/blender/bmesh/intern/bmesh_queries.c
trunk/blender/source/blender/bmesh/intern/bmesh_queries.h
Modified: trunk/blender/source/blender/bmesh/intern/bmesh_queries.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_queries.c 2012-10-20 16:04:15 UTC (rev 51455)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_queries.c 2012-10-20 16:48:04 UTC (rev 51456)
@@ -346,7 +346,9 @@
BLI_assert(BM_edge_is_manifold(e));
BLI_assert(BM_vert_in_edge(e, l->v));
- l_other = (e->l == l) ? l->radial_next : l;
+ l_other = (l->e == e) ? l : l->prev;
+ l_other = l_other->radial_next;
+ BLI_assert(l_other->e == e);
if (l_other->v == l->v) {
/* pass */
@@ -362,6 +364,55 @@
}
/**
+ * Utility function to step around a fan of loops,
+ * using an edge to mark the previous side.
+ *
+ * \note all edges must be manifold,
+ * once a non manifold edge is hit, return NULL.
+ *
+ * <pre>
+ * ,.,-->|
+ * _,-' |
+ * ,' | (notice how 'e_step'
+ * / | and 'l' define the
+ * / | direction the arrow
+ * | return | points).
+ * | loop --> |
+ * ---------------------+---------------------
+ * ^ l --> |
+ * | |
+ * assign e_step |
+ * |
+ * begin e_step ----> |
+ * |
+ * </pre>
+ */
+
+BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step)
+{
+ BMEdge *e_prev = *e_step;
+ BMEdge *e_next;
+ if (l->e == e_prev) {
+ e_next = l->prev->e;
+ }
+ else if (l->prev->e == e_prev) {
+ e_next = l->e;
+ }
+ else {
+ BLI_assert(0);
+ }
+
+ if (BM_edge_is_manifold(e_next)) {
+ return BM_edge_other_loop((*e_step = e_next), l);
+ }
+ else {
+ return NULL;
+ }
+}
+
+
+
+/**
* The function takes a vertex at the center of a fan and returns the opposite edge in the fan.
* All edges in the fan must be manifold, otherwise return NULL.
*
Modified: trunk/blender/source/blender/bmesh/intern/bmesh_queries.h
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_queries.h 2012-10-20 16:04:15 UTC (rev 51455)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_queries.h 2012-10-20 16:48:04 UTC (rev 51456)
@@ -44,6 +44,7 @@
BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v);
BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v);
BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v);
+BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step);
BMLoop *BM_vert_find_first_loop(BMVert *v);
int BM_vert_edge_count_nonwire(BMVert *v);
More information about the Bf-blender-cvs
mailing list