[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16209] branches/harmonic-skeleton/source/ blender/src/reeb.c: Vertice outside of faces would create zero degree nodes and mess up later.

Martin Poirier theeth at yahoo.com
Thu Aug 21 20:12:38 CEST 2008


Revision: 16209
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16209
Author:   theeth
Date:     2008-08-21 20:12:36 +0200 (Thu, 21 Aug 2008)

Log Message:
-----------
Vertice outside of faces would create zero degree nodes and mess up later.

Do a single pass to remove those after reeb graph creation (but before filtering).

Modified Paths:
--------------
    branches/harmonic-skeleton/source/blender/src/reeb.c

Modified: branches/harmonic-skeleton/source/blender/src/reeb.c
===================================================================
--- branches/harmonic-skeleton/source/blender/src/reeb.c	2008-08-21 17:28:58 UTC (rev 16208)
+++ branches/harmonic-skeleton/source/blender/src/reeb.c	2008-08-21 18:12:36 UTC (rev 16209)
@@ -1296,7 +1296,6 @@
 				merging = 2;
 			}
 			
-
 			if (merging)
 			{
 				BLI_ReflagSubgraph((BGraph*)rg, end_node->flag, subgraph);
@@ -1978,22 +1977,22 @@
 
 /***************************************** MAIN ALGORITHM **********************************************/
 
-ReebArc * findConnectedArc(ReebGraph *rg, ReebArc *arc, ReebNode *v)
+/* edges alone will create zero degree nodes, use this function to remove them */
+void removeZeroNodes(ReebGraph *rg)
 {
-	ReebArc *nextArc = arc->next;
+	ReebNode *node, *next_node;
 	
-	for(nextArc = rg->arcs.first; nextArc; nextArc = nextArc->next)
+	for (node = rg->nodes.first; node; node = next_node)
 	{
-		if (arc != nextArc && (nextArc->head == v || nextArc->tail == v))
+		next_node = node->next;
+		
+		if (node->degree == 0)
 		{
-			break;
+			BLI_removeNode((BGraph*)rg, (BNode*)node);
 		}
 	}
-	
-	return nextArc;
 }
 
-
 void removeNormalNodes(ReebGraph *rg)
 {
 	ReebArc *arc, *nextArc;
@@ -2539,9 +2538,10 @@
 	
 	printf("\n");
 	
-	
 	BLI_listbase_from_dlist(dlist, &rg->nodes);
 	
+	removeZeroNodes(rg);
+	
 	removeNormalNodes(rg);
 	
 	return rg;





More information about the Bf-blender-cvs mailing list