[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30285] branches/soc-2010-rohith291991/ intern/comiso/intern/uv.cpp: fixes in the parametrization.

Rohith B V rohith291991 at gmail.com
Tue Jul 13 23:48:02 CEST 2010


Revision: 30285
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30285
Author:   rohith291991
Date:     2010-07-13 23:48:02 +0200 (Tue, 13 Jul 2010)

Log Message:
-----------
fixes in the parametrization.

Modified Paths:
--------------
    branches/soc-2010-rohith291991/intern/comiso/intern/uv.cpp

Modified: branches/soc-2010-rohith291991/intern/comiso/intern/uv.cpp
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/uv.cpp	2010-07-13 21:07:34 UTC (rev 30284)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/uv.cpp	2010-07-13 21:48:02 UTC (rev 30285)
@@ -301,38 +301,53 @@
     bool singular = mesh->verts[i].flag & CV_SINGULARITY;
     //Map::Halfedge* hi = vi->halfedge() ;
     //go to the previous seam edge if any
-	int start=0;
+	int start=-1;
 	for(int j=0;j<mesh->verts[i].numNeighbors;j++)
 		{
-		if(mesh->edges[mesh->verts[i].edges[j]].flag & CE_MARKED)
+		if(!(mesh->edges[mesh->verts[i].edges[j]].flag & CE_MARKED))
 			{
 			start=j;
 			break;
 			}
     }
 
-
     //Map::Halfedge* start = hi ;
     if(singular) ids_to_round.push_back(2*nvar) ;
     if(singular) ids_to_round.push_back(2*nvar+1) ;
-    //separate the vertex in different variables for each parametric position
 
+	if(start!=-1)
+		{++nvar;
+	if(singular) ids_to_round.push_back(2*nvar) ;
+	if(singular) ids_to_round.push_back(2*nvar+1) ;}
+	
+	 //separate the vertex in different variables for each parametric position
+
 	for(int j=start+1;j<mesh->verts[i].numNeighbors;j++)
    {
-     if(mesh->edges[mesh->verts[i].edges[j]].flag & CE_MARKED)
+     if(!(mesh->edges[mesh->verts[i].edges[j]].flag & CE_MARKED))
 		 {//we justed crossed a cut, different from the original one (if any)
 	//the vertex must be duplicated
 	++nvar ;
 	if(singular) ids_to_round.push_back(2*nvar) ;
 	if(singular) ids_to_round.push_back(2*nvar+1) ;
+
       }
-      mesh->edges[mesh->verts[i].edges[j]].vvar[0] = nvar ;
+      mesh->edges[mesh->verts[i].edges[j]].vvar[0] = nvar;
+
+	   if(!(mesh->edges[mesh->verts[i].edges[j]].flag & CE_MARKED))
+		 {//we justed crossed a cut, different from the original one (if any)
+	//the vertex must be duplicated
+	++nvar ;
+	if(singular) ids_to_round.push_back(2*nvar) ;
+	if(singular) ids_to_round.push_back(2*nvar+1) ;
+
+      }
 	  mesh->edges[mesh->verts[i].edges[j]].vvar[1] = nvar ;
       //hi = hi->prev_around_vertex() ;
     }
   
     ++nvar ;
-  }
+	 }
 
   //Distribute seam edge variables
   //MapHalfedgeAttribute<int> tvar(map,"tvar") ;//variable index of the integer translation of the seam
@@ -346,8 +361,9 @@
 
   for(int i=0;i<totedge;i++){
     //check that the edge forms a seam, and was not already given a tvar index
-    if(mesh->edges[i].flag & CE_MARKED)
+    if(!(mesh->edges[i].flag & CE_MARKED))
 			{
+			printf("edgesses\n");
       mesh->edges[i].test[0] = 1;
 	mesh->edges[i].test[1] = 1;	
       //provide variables for the edge and its opposite edge
@@ -385,7 +401,10 @@
     //Map::Halfedge* hi = fi->halfedge() ;
     int v[3] ;
     for(int i=0; i<3; ++i) {
-      v[i] = mesh->edges[mesh->faces[j].edges[i]].vvar[0];
+		int t=0;
+		if(j!=mesh->edges[mesh->faces[j].edges[i]].faces[0])
+			t=1;
+      v[i] = mesh->edges[mesh->faces[j].edges[i]].vvar[t];
       //hi = hi->next() ;
     }
 
@@ -437,9 +456,9 @@
  
 
   // BIG TODO
-  /*int constraint = 0 ;
+  int constraint = 0 ;
  for(int i=0;i<totedge;i++) {
-    if(mesh->edges[i].flag & CE_MARKED)
+    if(!(mesh->edges[i].flag & CE_MARKED))
 			{
       //recover the opposite indices
       int vp_in  = mesh->edges[i].vvar[0];
@@ -447,7 +466,7 @@
       int vq_out  = mesh->edges[i].vvar[1];
       int vq_in =  mesh->edges[i].vvar[1]; //TODO change
       if(vp_in == vp_out || vq_in == vq_out) {
-	//continue ;
+	continue ;
       }
       //use the rotation of the edge
       int rotation = (4-mesh->edges[i].p)%4 ;
@@ -481,12 +500,20 @@
       constraint += 4 ;
     }
   }
-*/
+
 /*
  std::cout<<A<<"\n\n";
  std::cout<<C<<"\n\n";*/
 
   //Solve
+
+ 	std::cout<<"b: \n\n";
+	for(int i=0;i<b.size();i++)
+	{
+	
+	std::cout<<b[i]<<"\n";
+	}
+
   std::vector<double> x(2*nvar,0) ;
 
 
@@ -503,13 +530,8 @@
 	cs.restore_eliminated_vars( C,x, ids_to_elim, new_idx);
 
 
-	std::cout<<"b: \n\n";
-	for(int i=0;i<b.size();i++)
-	{
+
 	
-	std::cout<<b[i]<<"\n";
-	}
-
 std::cout<<"x: \n\n";
 for(int i=0;i<x.size();i++)
 	{
@@ -517,6 +539,7 @@
 	std::cout<<x[i]<<"\n";
 	}
 
+printf("%d\n",nvar);
   //TODO check what this is
   /*
   MapHalfedgeAttribute<double> je(map,"je") ;





More information about the Bf-blender-cvs mailing list