[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37449] branches/soc-2011-avocado/blender: Non-manifold mesh support added in the dual graph code, Combinatorial distance vector of dual edges are used for EigenValue calculation .

shuvro sarker shuvro05 at gmail.com
Mon Jun 13 14:13:23 CEST 2011


Revision: 37449
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37449
Author:   shuvro
Date:     2011-06-13 12:13:22 +0000 (Mon, 13 Jun 2011)
Log Message:
-----------
Non-manifold mesh support added in the dual graph code, Combinatorial distance vector of dual edges are used for EigenValue calculation.

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

Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamUtility.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamUtility.cpp	2011-06-13 12:03:13 UTC (rev 37448)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamUtility.cpp	2011-06-13 12:13:22 UTC (rev 37449)
@@ -70,7 +70,7 @@
      structure will be improved for efficiency. */
     for(c_index = 0; c_index < num_col; c_index++){
         for(r_index = 0; r_index < num_row; r_index++){
-            if(dual_matrix[r_index][c_index]){
+            if(dual_matrix[r_index][c_index] != 0.0){
                 dualMatrix(r_index, c_index) = dual_matrix[r_index][c_index];
             }
             else dualMatrix(r_index, c_index) = 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-13 12:03:13 UTC (rev 37448)
+++ branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c	2011-06-13 12:13:22 UTC (rev 37449)
@@ -30,6 +30,7 @@
 #include "autoseam_C_API.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <math.h>
 #include "WM_types.h"
 
 #include "RNA_types.h"
@@ -54,20 +55,24 @@
 
 #include "ED_screen.h"
 #include "MEM_guardedalloc.h"
-
 #include "bmesh.h"
 
+#define MAX_LOOPS_OF_EDGE 1000
 
 
-static int compute_dual_graph(BMesh *bm)
+static int compute_dual_graph(BMesh *bm, int combinatorial)
 {
     BMEdge *eed;
     BMIter iter, iter2;
     BMLoop *l;
     
-    int i,k,m,face_index[2];
+    int i,k,m,face_index[MAX_LOOPS_OF_EDGE];
+    float poly_centres[MAX_LOOPS_OF_EDGE][3];
+    double edge_length;
+    
     float **dummy_dual_graph;
     int num_faces;
+    //float face_center[3], face_center_second[3];
     
     num_faces = BM_Count_Element(bm, BM_FACE);
     printf("The number of faces: %d\n", num_faces);
@@ -92,15 +97,36 @@
         /* if not boundary edge */
         if(!BM_Boundary_Edge(eed)){
             
+            printf("is manifold : %d", BM_Nonmanifold_Edge(bm,eed));
             printf("index : %d\n", eed->head.index);
             i = 0;
             
             BM_ITER(l, &iter2, bm, BM_LOOPS_OF_EDGE, eed) {
-                
                 face_index[i++] = l->f->head.index;
+                BM_Compute_Face_Center(bm, l->f, poly_centres[i]);
             }
-            printf("%d %d", face_index[0], face_index[1]);
-            dummy_dual_graph[face_index[0]][face_index[1]] = 1;
+            
+            for(m = 0; m < i ; m++){
+                for(k = m + 1 ; k < i ; k++){
+                    
+                    if(!combinatorial){
+                        dummy_dual_graph[face_index[m]][face_index[k]] = 1;
+                        printf("%d %d", face_index[m], face_index[k]);
+                    }
+                    else{
+                        double dx, dy, dz;
+                        
+                        dx = poly_centres[m][0] - poly_centres[k][0];
+                        dy = poly_centres[m][1] - poly_centres[k][1];
+                        dz = poly_centres[m][2] - poly_centres[k][2];
+                        edge_length = sqrt(dx*dx + dy*dy + dz*dz);
+                        printf("The edge length is: %lf\n",edge_length);
+                        dummy_dual_graph[face_index[m]][face_index[k]] = edge_length;
+                        //int BM_Compute_Face_Center ( BMesh *bm, BMFace *f, float center[3] );
+                    }
+                }
+            }
+            //dummy_dual_graph[face_index[0]][face_index[1]] = 1;
         }
         else
         {
@@ -126,7 +152,7 @@
 	BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
 	BMesh *bm = em->bm;
 
-    compute_dual_graph(bm);
+    compute_dual_graph(bm,1);
     return 0;
 }
 




More information about the Bf-blender-cvs mailing list