[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37922] branches/soc-2011-avocado/blender/ intern/autoseam/AutoseamAdjacency.cpp: Fixes problem with meshes having no face

shuvro sarker shuvro05 at gmail.com
Tue Jun 28 20:56:18 CEST 2011


Revision: 37922
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37922
Author:   shuvro
Date:     2011-06-28 18:56:17 +0000 (Tue, 28 Jun 2011)
Log Message:
-----------
Fixes problem with meshes having no face

Modified Paths:
--------------
    branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp

Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp	2011-06-28 17:59:06 UTC (rev 37921)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp	2011-06-28 18:56:17 UTC (rev 37922)
@@ -84,35 +84,39 @@
         double rowsum = a.row(i).sum();
         a(i,i) = -rowsum;
     }
+    
+    if(a.rows() && a.cols()){
+        
+        Eigen::SelfAdjointEigenSolver<MatrixXd> es(a);
+        Eigen::VectorXd evalues(es.eigenvalues());
+        int f = 0;
+        bool found = false;
 
-    Eigen::SelfAdjointEigenSolver<MatrixXd> es(a);
-    Eigen::VectorXd evalues(es.eigenvalues());
-    int f = 0;
-    bool found = false;
-//    int seam_length=0;
-    MatrixXd aplus;
-    MatrixXd aminus;
-    //while ( (f < n) && (f<30) ) {
-    while ( (f < n)) {
-        // Eigenvalues seem to be sorted largest to smallest, we need the 30 smallest
-        // in the future only those will be calculated by the algorithm (if we use ARPACK)
-        AutoseamEigenspace* aes = new AutoseamEigenspace(evalues[n-f-1], es.eigenvectors().col(n-f-1));
+        MatrixXd aplus;
+        MatrixXd aminus;
+    
+        while ( (f < n)) {
+            // Eigenvalues seem to be sorted largest to smallest, we need the 30 smallest
+            // in the future only those will be calculated by the algorithm (if we use ARPACK)
+            AutoseamEigenspace* aes = new AutoseamEigenspace(evalues[n-f-1], es.eigenvectors().col(n-f-1));
 
-        // split Eigenspace into two subspaces F+ and F- where the ith entry in the eigenvector is positive/negative
-        aes->split();
+            // split Eigenspace into two subspaces F+ and F- where the ith entry in the eigenvector is positive/negative
+            aes->split();
 
-
-        aes->fill_adjacency(a, aplus, aminus);
-        // We filter out eigenspaces that give non-connected F+ and F- as in the paper
-        if (is_graph_connected(aplus) && is_graph_connected(aminus)) {
-            m_eigenspaces.push_back(aes);
-            found = true;
-        } else {
+            aes->fill_adjacency(a, aplus, aminus);
+            // We filter out eigenspaces that give non-connected F+ and F- as in the paper
+            if (is_graph_connected(aplus) && is_graph_connected(aminus)) {
+                m_eigenspaces.push_back(aes);
+                found = true;
+            } 
+            else {
             delete aes;
+            }
+            f++;
         }
-        f++;
+        return found;
     }
-    return found;
+    return 0;
 }
 
 int AutoseamAdjacency::get_num_splits()




More information about the Bf-blender-cvs mailing list