diff c/Motion.cpp @ 201:f7ddfc4aeb1e

added tests for graphs
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 05 Mar 2012 01:52:56 -0500
parents 0a27fa343257
children bc93e87a2108 bc4ea09b1743
line wrap: on
line diff
--- a/c/Motion.cpp	Fri Mar 02 19:32:54 2012 -0500
+++ b/c/Motion.cpp	Mon Mar 05 01:52:56 2012 -0500
@@ -84,7 +84,7 @@
       minDistance = distance;
     else if (distance > maxDistance)
       maxDistance = distance;
-    connected = connected && (maxDistance-minDistance < segmentationDistance);
+    connected = connected && (maxDistance-minDistance <= segmentationDistance);
     t++;
   }
 
@@ -177,10 +177,10 @@
   property_map<UndirectedGraph, int VertexInformation::*>::type components = get(&VertexInformation::index, graph);
 
   int num = connected_components(graph, components, vertex_index_map(get(&VertexInformation::index, graph)));
-  cout << "Total number of components: " << num << endl;
+  cout << "last instant threshold " << lastInstant << " Total number of components: " << num << endl;
 
-  vector<unsigned int> lastInstants(num, 0);
-  vector<vector<vertex_descriptor> > tmpobjects(num), objects;
+  vector<unsigned int> lastInstants(num, 0); // last instant of component with id
+  vector<vector<vertex_descriptor> > tmpobjects(num), objects; // vector of components (component = vector of vertex descriptors)
 
   graph_traits<UndirectedGraph>::vertex_iterator vi, vend;
   for(tie(vi,vend) = vertices(graph); vi != vend; ++vi) {