[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15885] branches/harmonic-skeleton/source/ blender/src/reeb.c: Merge subgraph with closest node, not just first node under threshold.
Martin Poirier
theeth at yahoo.com
Wed Jul 30 20:10:21 CEST 2008
Revision: 15885
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15885
Author: theeth
Date: 2008-07-30 20:10:21 +0200 (Wed, 30 Jul 2008)
Log Message:
-----------
Merge subgraph with closest node, not just first node under threshold.
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-07-30 17:41:47 UTC (rev 15884)
+++ branches/harmonic-skeleton/source/blender/src/reeb.c 2008-07-30 18:10:21 UTC (rev 15885)
@@ -1130,14 +1130,25 @@
if (start_node->flag == subgraph && start_node->degree == 1)
{
+ ReebNode *min_node = NULL;
+ float min_distance = FLT_MAX;
+
for (end_node = rg->nodes.first; end_node; end_node = end_node->next)
{
- if (end_node->flag != subgraph && VecLenf(start_node->p, end_node->p) < threshold)
+ if (end_node->flag != subgraph)
{
- break;
+ float distance = VecLenf(start_node->p, end_node->p);
+
+ if (distance < threshold && distance < min_distance)
+ {
+ min_distance = distance;
+ min_node = end_node;
+ }
}
}
+ end_node = min_node;
+
if (end_node)
{
ReebArc *start_arc, *end_arc;
More information about the Bf-blender-cvs
mailing list