[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37886] branches/soc-2011-avocado/blender: tuning of the recursive implementation and code clean up.

shuvro sarker shuvro05 at gmail.com
Tue Jun 28 05:49:00 CEST 2011


Revision: 37886
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37886
Author:   shuvro
Date:     2011-06-28 03:48:59 +0000 (Tue, 28 Jun 2011)
Log Message:
-----------
tuning of the recursive implementation and code clean up.

Modified Paths:
--------------
    branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
    branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c

Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp	2011-06-28 02:49:49 UTC (rev 37885)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp	2011-06-28 03:48:59 UTC (rev 37886)
@@ -18,8 +18,6 @@
 
 int AutoseamAdjacency::get(int row, int col)
 {
-    printf("num rows: %ld cols: %ld", m_adjacency.rows(), m_adjacency.cols());
-    printf("row: %d col: %d and the adjacency value is: %f",row, col, m_adjacency(row, col));
     return m_adjacency(row, col) > 0.05 ? 1 : 0;
 }
 

Modified: branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c	2011-06-28 02:49:49 UTC (rev 37885)
+++ branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c	2011-06-28 03:48:59 UTC (rev 37886)
@@ -116,7 +116,7 @@
 						bSeam = find_index(idx2, fplus, nplus);
 					}
 					other_face=BMIter_Step(&face_iter);
-                    printf("indexes are %d %d\n", idx1, idx2);
+                    //printf("indexes are %d %d\n", idx1, idx2);
 				}
             }
             if (bSeam){
@@ -144,7 +144,6 @@
     int i;
     
     for(i = 0; i < num_array_element; i++){
-        //printf("%d ", array[i]);
         if(array[i] == element) return  1;
     }
     
@@ -160,9 +159,6 @@
     float edge_length;
     float poly_centres[2][3];
     int k;
-
-    //for( k = 0; k < num_faces; k++) printf("%d ", faces[k]);
-    printf("\n");
     
     for(edge = BMIter_New(&edge_iter, bm, BM_EDGES_OF_MESH, bm ); edge; edge= BMIter_Step(&edge_iter)) 
     {
@@ -178,8 +174,7 @@
                     autoseam_set_adjacent(adj, loop->f->head.index, loop->radial_next->f->head.index, 1.0);
                 }
                 else{
-                    
-                    double dx, dy, dz;
+                    float dx, dy, dz;
                     BM_Compute_Face_Center(bm, loop->f, poly_centres[0]);
                     BM_Compute_Face_Center(bm, loop->radial_next->f, poly_centres[1]);
                     
@@ -213,7 +208,7 @@
 }
 
 
-int generate_seam_recursive(BMesh *bm, AUTOSEAM_Adjacency adj, int recursion_depth)
+int generate_seam_recursive(BMesh *bm, AUTOSEAM_Adjacency adj, AUTOSEAM_Adjacency adj_big, int recursion_depth)
 {
     int s;
     int i, j;
@@ -251,13 +246,12 @@
     
     for(i = 0; i < nplus; i++){
         /*set's the mapping of the face index.This is placed here to reduce extra computation.*/
-        //printf("index: %d value :%d\n", i, fplus[i]);
+        
         autoseam_set_mapping(adj_plus, i, fplus[i]);
         
         for(j = i+1; j < nplus; j++){
-            if(autoseam_is_adjacent(adj, i, j)){
-                autoseam_set_adjacent(adj_plus, i, j, autoseam_get_value(adj, i, j));
-                //printf("adjacency index: %d %d value: %f\n", i, j, autoseam_get_value(adj, i, j));
+            if(autoseam_is_adjacent(adj_big, fplus[i], fplus[j])){
+                autoseam_set_adjacent(adj_plus, i, j, autoseam_get_value(adj_big, fplus[i], fplus[j]));
             }
         }
     }
@@ -269,13 +263,11 @@
     for(i = 0; i < nminus; i++){
         /*set's the mapping of the face index.This is placed here to reduce extra computation.*/
         autoseam_set_mapping(adj_minus, i, fminus[i]);
-        //printf("index: %d value :%d\n", i, fminus[i]);
         
         for(j = i+1; j < nminus; j++){
-            //printf("two values are: %d %d\n", fminus[i], fminus[j]);
-            if(autoseam_is_adjacent(adj, i, j)){
-                autoseam_set_adjacent(adj_plus, i, j, autoseam_get_value(adj, i, j));
-                //printf("adjacency index: %d %d value: %f\n", i, j, autoseam_get_value(adj, fminus[i], fminus[j]));
+            if(autoseam_is_adjacent(adj_big, fminus[i], fminus[j])){
+                autoseam_set_adjacent(adj_plus, i, j, autoseam_get_value(adj_big, fminus[i], fminus[j]));
+                
             }
         }
     }
@@ -289,9 +281,9 @@
     
     /* recursive calls for two parts of the mesh. */
     if(nplus > 0)
-        generate_seam_recursive(bm, adj_plus, recursion_depth);
+        generate_seam_recursive(bm, adj_plus, adj_big, recursion_depth);
     if(nminus > 0)
-        generate_seam_recursive(bm, adj_minus, recursion_depth);
+        generate_seam_recursive(bm, adj_minus, adj_big, recursion_depth);
     
     autoseam_delete_adjacency(adj);
         
@@ -308,6 +300,7 @@
     BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
     BMesh *bm = em->bm;
     AUTOSEAM_Adjacency adj;
+    AUTOSEAM_Adjacency adj_big;
     
 
     int num_faces;
@@ -316,19 +309,23 @@
     num_faces = BM_Count_Element(bm, BM_FACE);
 	
     adj = autoseam_create_adjacency(num_faces);
+    adj_big = autoseam_create_adjacency(num_faces);
     
     /* set initial indices, found out this is necessary, they get reset on operator redo */
     autoseam_prepare_graph(bm);
     
     /* this creates the adjacency matrix */
     autoseam_create_graph(adj, bm, 1, -1, NULL, 1);
+    autoseam_create_graph(adj_big, bm, 1, -1, NULL, 1);
     
     /* clear if any seam already exists. */
     autoseam_clear_seam(bm);
     autoseam_set_map_default(adj);
 	
-    generate_seam_recursive(bm, adj, MAX_DEPTH);
+    generate_seam_recursive(bm, adj, adj_big, MAX_DEPTH);
     
+    autoseam_delete_adjacency(adj_big);
+    
     DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
     WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
     




More information about the Bf-blender-cvs mailing list