[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15871] branches/harmonic-skeleton/source/ blender: Bug fixes:
Martin Poirier
theeth at yahoo.com
Tue Jul 29 22:20:24 CEST 2008
Revision: 15871
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15871
Author: theeth
Date: 2008-07-29 22:20:24 +0200 (Tue, 29 Jul 2008)
Log Message:
-----------
Bug fixes:
Retag subgraphs when merging, to prevent loops
Mark missing up link in multi resolution as NULL
Ignore hidden vertices when propagating weight between islands
Modified Paths:
--------------
branches/harmonic-skeleton/source/blender/blenlib/BLI_graph.h
branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c
branches/harmonic-skeleton/source/blender/src/reeb.c
Modified: branches/harmonic-skeleton/source/blender/blenlib/BLI_graph.h
===================================================================
--- branches/harmonic-skeleton/source/blender/blenlib/BLI_graph.h 2008-07-29 18:31:34 UTC (rev 15870)
+++ branches/harmonic-skeleton/source/blender/blenlib/BLI_graph.h 2008-07-29 20:20:24 UTC (rev 15871)
@@ -80,6 +80,7 @@
void BLI_freeAdjacencyList(BGraph *rg);
int BLI_FlagSubgraphs(BGraph *graph);
+void BLI_ReflagSubgraph(BGraph *graph, int old_subgraph, int new_subgraph);
#define SHAPE_RADIX 10 /* each shape level is encoded this base */
Modified: branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c
===================================================================
--- branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c 2008-07-29 18:31:34 UTC (rev 15870)
+++ branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c 2008-07-29 20:20:24 UTC (rev 15871)
@@ -275,6 +275,19 @@
return subgraph;
}
+void BLI_ReflagSubgraph(BGraph *graph, int old_subgraph, int new_subgraph)
+{
+ BNode *node;
+
+ for (node = graph->nodes.first; node; node = node->next)
+ {
+ if (node->flag == old_subgraph)
+ {
+ node->flag = new_subgraph;
+ }
+ }
+}
+
/*************************************** CYCLE DETECTION ***********************************************/
int detectCycle(BNode *node, BArc *src_arc)
Modified: branches/harmonic-skeleton/source/blender/src/reeb.c
===================================================================
--- branches/harmonic-skeleton/source/blender/src/reeb.c 2008-07-29 18:31:34 UTC (rev 15870)
+++ branches/harmonic-skeleton/source/blender/src/reeb.c 2008-07-29 20:20:24 UTC (rev 15871)
@@ -350,7 +350,8 @@
{
ReebEdge *edge;
ReebNode *head = (ReebNode*)arc->head;
- printf("arc: (%i)%f -> (%i)%f\n", head->index, head->weight, head->index, head->weight);
+ ReebNode *tail = (ReebNode*)arc->tail;
+ printf("arc: (%i) %f -> (%i) %f\n", head->index, head->weight, tail->index, tail->weight);
for(edge = arc->edges.first; edge ; edge = edge->next)
{
@@ -499,7 +500,7 @@
#endif
}
-void verifyMultiResolutionLinks(ReebGraph *rg)
+void verifyMultiResolutionLinks(ReebGraph *rg, int level)
{
#ifdef DEBUG_REEB
ReebGraph *lower_rg = rg->link_up;
@@ -512,12 +513,16 @@
{
if (BLI_findindex(&lower_rg->arcs, arc->link_up) == -1)
{
- printf("missing arc %p\n", arc->link_up);
+ printf("missing arc %p for level %i\n", arc->link_up, level);
+ printf("Source arc was ---\n");
+ printArc(arc);
+
+ arc->link_up = NULL;
}
}
- verifyMultiResolutionLinks(lower_rg);
+ verifyMultiResolutionLinks(lower_rg, level + 1);
}
#endif
}
@@ -1160,7 +1165,9 @@
if (merging)
- {
+ {
+ BLI_ReflagSubgraph((BGraph*)rg, end_node->flag, subgraph);
+
resizeArcBuckets(start_arc);
fillArcEmptyBuckets(start_arc);
@@ -1334,7 +1341,7 @@
blend = (float)newNode->degree / (float)(newNode->degree + removedNode->degree); // blending factors
- VecLerpf(newNode->p, newNode->p, removedNode->p, blend);
+ VecLerpf(newNode->p, removedNode->p, newNode->p, blend);
filterArc(rg, newNode, removedNode, arc, 0);
@@ -1440,9 +1447,6 @@
if (middleNode->degree == 2)
{
continue;
-// removedNode = middleNode;
-//
-// filterArc(rg, terminalNode, removedNode, arc, 1);
}
// Otherwise, just plain remove of the arc
else
@@ -1463,9 +1467,6 @@
value = 1;
}
}
-
- /* join on normal nodes */
- removeNormalNodes(rg);
return value;
}
@@ -1690,19 +1691,19 @@
{
done = 0; /* no work done yet */
+ if (options & SKGEN_FILTER_INTERNAL)
+ {
+// done |= filterInternalReebGraph(rg, threshold_internal * rg->resolution);
+ done |= filterInternalReebGraph(rg, threshold_internal);
+ verifyNodeDegree(rg);
+ }
+
if (options & SKGEN_FILTER_EXTERNAL)
{
// done |= filterExternalReebGraph(rg, threshold_external * rg->resolution);
done |= filterExternalReebGraph(rg, threshold_external);
verifyNodeDegree(rg);
}
-
- if (options & SKGEN_FILTER_INTERNAL)
- {
-// done |= filterInternalReebGraph(rg, threshold_internal * rg->resolution);
- done |= filterInternalReebGraph(rg, threshold_internal);
- verifyNodeDegree(rg);
- }
}
if (options & SKGEN_FILTER_SMART)
@@ -2842,10 +2843,12 @@
for (eve = em->verts.first; eve; eve = eve->next)
{
- if (eve->f1 != 1)
+ /* for every vertex visible that hasn't been processed yet */
+ if (eve->h == 0 && eve->f1 != 1)
{
EditVert *closest_eve;
+ /* find the closest processed vertex */
for (closest_eve = em->verts.first; closest_eve; closest_eve = closest_eve->next)
{
/* vertex is already processed and distance is smaller than current minimum */
@@ -3292,7 +3295,7 @@
relinkNodes(previous, rgi);
}
- verifyMultiResolutionLinks(rg);
+ verifyMultiResolutionLinks(rg, 0);
return rg;
}
More information about the Bf-blender-cvs
mailing list