Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2007-11-29 01:43:33 +0300
committerMartin Poirier <theeth@yahoo.com>2007-11-29 01:43:33 +0300
commit1cb7325c2b84a8574697232bb0f765fe2166e4b3 (patch)
treef62f3f549baaa1daba51f08c670da43cac1e0391 /source/blender/src/reeb.c
parent24beb8fb8c9042019827ecfefb05d074083c78b5 (diff)
Fix for crashes due to non-working cycle detection.
Start of radial symmetric function.
Diffstat (limited to 'source/blender/src/reeb.c')
-rw-r--r--source/blender/src/reeb.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/src/reeb.c b/source/blender/src/reeb.c
index c35f3ad766b..cf826b22e76 100644
--- a/source/blender/src/reeb.c
+++ b/source/blender/src/reeb.c
@@ -815,7 +815,7 @@ void spreadWeight(EditMesh *em)
}
/*********************************** GRAPH AS TREE FUNCTIONS *******************************************/
-int subtreeDepth(ReebNode *node)
+int subtreeDepth(ReebNode *node, ReebArc *rootArc)
{
int depth = 0;
@@ -833,9 +833,11 @@ int subtreeDepth(ReebNode *node)
ReebArc *arc = *pArc;
/* only arcs that go down the tree */
- if (arc->v1 == node)
+ if (arc != rootArc)
{
- depth = MAX2(depth, subtreeDepth(arc->v2));
+ ReebNode *newNode = OTHER_NODE(arc, node);
+ printf("recurse\n");
+ depth = MAX2(depth, subtreeDepth(newNode, arc));
}
}
}
@@ -845,19 +847,26 @@ int subtreeDepth(ReebNode *node)
/*************************************** CYCLE DETECTION ***********************************************/
-int detectCycle(ReebNode *node)
+int detectCycle(ReebNode *node, ReebArc *srcArc)
{
int value = 0;
- if (node->flags != 0)
+ if (node->flags == 0)
{
ReebArc ** pArc;
+ /* mark node as visited */
+ node->flags = 1;
+
for(pArc = node->arcs; *pArc && value == 0; pArc++)
{
ReebArc *arc = *pArc;
- value = detectCycle(OTHER_NODE(arc, node));
+ /* don't go back on the source arc */
+ if (arc != srcArc)
+ {
+ value = detectCycle(OTHER_NODE(arc, node), arc);
+ }
}
}
else
@@ -868,7 +877,7 @@ int detectCycle(ReebNode *node)
return value;
}
-int isGraphAcyclic(ReebGraph *rg)
+int isGraphCyclic(ReebGraph *rg)
{
ReebNode *node;
int value = 0;
@@ -887,7 +896,7 @@ int isGraphAcyclic(ReebGraph *rg)
/* only for nodes in subgraphs that haven't been visited yet */
if (node->flags == 0)
{
- value = detectCycle(node);
+ value = value || detectCycle(node, NULL);
}
}