[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30047] branches/soc-2010-rohith291991: Some progress on parametrization.

Rohith B V rohith291991 at gmail.com
Tue Jul 6 17:30:25 CEST 2010


Revision: 30047
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30047
Author:   rohith291991
Date:     2010-07-06 17:30:25 +0200 (Tue, 06 Jul 2010)

Log Message:
-----------
Some progress on parametrization.

Modified Paths:
--------------
    branches/soc-2010-rohith291991/intern/comiso/extern/CMesh.h
    branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp
    branches/soc-2010-rohith291991/intern/comiso/intern/comiso.cpp
    branches/soc-2010-rohith291991/source/blender/modifiers/intern/MOD_quadrangulate.c

Modified: branches/soc-2010-rohith291991/intern/comiso/extern/CMesh.h
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/extern/CMesh.h	2010-07-06 14:41:21 UTC (rev 30046)
+++ branches/soc-2010-rohith291991/intern/comiso/extern/CMesh.h	2010-07-06 15:30:25 UTC (rev 30047)
@@ -21,6 +21,7 @@
 {
 
 int * neighbors; //Indices of all neighboring vertices
+int * edges; //Indices of the edges, corresponding to neighbors
 int index; //Index of the vertex
 int flag; //Flag for various purposes (if needed)
 int numNeighbors; //Number of neighboring vertices

Modified: branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp	2010-07-06 14:41:21 UTC (rev 30046)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp	2010-07-06 15:30:25 UTC (rev 30047)
@@ -101,7 +101,6 @@
 					
 				}
 
-
 					}
 				else
 					{
@@ -385,7 +384,7 @@
 return 1;
 }
 
-//TODO
+//TODO change
 int generateParametrization(CMesh *mesh,double h)
 {
 
@@ -396,7 +395,30 @@
 totvert=mesh->numVerts;
 totedge=mesh->numEdges;
 totface=mesh->numFaces;
+std::vector< std::vector <int> > currentFaces; //List of faces to expand for BFS/Dijkstra
 
+
+for(int i=0;i<mesh->numFaces;i++)
+			{
+			mesh->faces[i].flag=0;
+			//mesh->faces[i].group=mesh->faces[i].index;	
+			}
+
+for(int i=0;i<mesh->numEdges;i++)
+			{
+			mesh->edges[i].flag=0;
+			//mesh->faces[i].group=mesh->faces[i].index;	
+			}
+
+
+
+mesh->faces[0].flag|=CF_CONSTRAINED|CF_VISITED;
+mesh->faces[0].group=0;
+
+currentFaces.resize(1);
+currentFaces[0].push_back(0);
+
+/*
 for(int i=0;i<totface;i++)
 	{
 
@@ -423,12 +445,12 @@
 	y2=mesh->verts[v2].co[1]-mesh->verts[v1].co[1];
 	z2=mesh->verts[v2].co[2]-mesh->verts[v1].co[2];
 
-	/*
+	
 	i  j  k
 	x1 y1 z1
 	x2 y2 z2
 		
-   x1(y2k-z2j)-y1(x2k-z2i)+z1(x2j-y2i)*/
+   x1(y2k-z2j)-y1(x2k-z2i)+z1(x2j-y2i)
 
    double area=sqrt((x1*y2-y1*x2)*(x1*y2-y1*x2)+(y1*z2-y2*z1)*(y1*z2-y2*z1)+(z1*x2-z2*x1)*(z1*x2-z2*x1));
 	totarea+=area;
@@ -439,5 +461,128 @@
 
 	}
 	
+//
+*/
+
+int terminate=1;
+
+while(terminate)
+{
+
+	terminate=0;
+
+	int i=0;
+
+		std::vector<int> newFaces;
+		newFaces.resize(0);
+
+		for(int j=0;j<currentFaces[i].size();j++)
+		{
+
+			terminate++;
+
+			int index=currentFaces[i][j];
+			CFace *face=&(mesh->faces[index]);
+			
+			for(int k=0;k<face->numNeighbors;k++)
+			{
+	
+				int nIndex=face->neighbors[k];
+			
+				if(!(mesh->faces[nIndex].flag & CF_VISITED))
+				{
+
+				if(!(mesh->faces[nIndex].flag & CF_VISITED))
+				newFaces.push_back(nIndex);
+
+				mesh->faces[nIndex].flag |= CF_VISITED;
+				mesh->faces[nIndex].group=face->group;
+
+				int v[2];
+                int cv=0;
+				//Mark common vertices
+				for(int l=0;l<4;l++)
+					for(int k=0;k<4;k++)
+						if( (mesh->faces[index].v[l] == mesh->faces[nIndex].v[k])
+						&& mesh->faces[index].v[k]!=-1)
+							{
+							v[cv]=mesh->faces[index].v[l]; 
+							cv++;
+							}
+
+				for(int l=0;l<mesh->numEdges;l++)
+				{
+					
+					if((mesh->edges[l].v[0]==v[0]&&mesh->edges[l].v[1]==v[1]))
+							{
+								face->edges[k]=mesh->edges[l].index;	
+								mesh->edges[l].faces[0]=index;
+								mesh->edges[l].faces[1]=nIndex;
+								mesh->edges[l].flag |= CE_MARKED;
+								mesh->edges[l].p=0;	
+
+							}
+							
+							else if((mesh->edges[l].v[0]==v[1]&&mesh->edges[l].v[1]==v[0] ))
+							{
+								face->edges[k]=mesh->edges[l].index;
+								mesh->edges[l].faces[1]=index;
+								mesh->edges[l].faces[0]=nIndex;
+								mesh->edges[l].flag |= CE_MARKED;
+								mesh->edges[l].p=0;	
+
+							}
+					
+				}
+
+					}
+				else
+					{
+				
+					int v[2];
+					int cv=0;
+					//Mark common vertices
+					for(int l=0;l<4;l++)
+						for(int k=0;k<4;k++)
+							if( (mesh->faces[index].v[l] == mesh->faces[nIndex].v[k])
+							&& mesh->faces[index].v[k]!=-1)
+							{
+								v[cv]=mesh->faces[index].v[l]; 
+								cv++;
+							}
+					
+						for(int l=0;l<mesh->numEdges;l++)
+						{
+							
+							if((mesh->edges[l].v[0]==v[0]&&mesh->edges[l].v[1]==v[1]))
+							{
+								face->edges[k]=mesh->edges[l].index;	
+								mesh->edges[l].faces[0]=index;
+								mesh->edges[l].faces[1]=nIndex;
+
+							}
+							
+							else if((mesh->edges[l].v[0]==v[1]&&mesh->edges[l].v[1]==v[0] ))
+							{
+								face->edges[k]=mesh->edges[l].index;
+								mesh->edges[l].faces[1]=index;
+								mesh->edges[l].faces[0]=nIndex;
+
+							}
+					
+						}
+					}
+
+				}
+			
+		}
+
+		currentFaces[i].resize(newFaces.size());
+
+		for(int l=0;l<newFaces.size();l++)
+			currentFaces[i][l]=newFaces[l];
+
+}
+
 return 1;
 }
\ No newline at end of file

Modified: branches/soc-2010-rohith291991/intern/comiso/intern/comiso.cpp
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/comiso.cpp	2010-07-06 14:41:21 UTC (rev 30046)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/comiso.cpp	2010-07-06 15:30:25 UTC (rev 30047)
@@ -183,7 +183,6 @@
 		ids_to_round[k]=_data.rdata[k];
 
 		}
-
 	
 	result=Solve(B,C,ids_to_round,_precision,_numGauss,_numCG);
 

Modified: branches/soc-2010-rohith291991/source/blender/modifiers/intern/MOD_quadrangulate.c
===================================================================
--- branches/soc-2010-rohith291991/source/blender/modifiers/intern/MOD_quadrangulate.c	2010-07-06 14:41:21 UTC (rev 30046)
+++ branches/soc-2010-rohith291991/source/blender/modifiers/intern/MOD_quadrangulate.c	2010-07-06 15:30:25 UTC (rev 30047)
@@ -231,7 +231,7 @@
 			cm.faces[3].theta=1.3;
 			cm.faces[10].flag |= CF_CONSTRAINED;
 			cm.faces[10].theta=2.35;	
-cm.faces[25].flag |= CF_CONSTRAINED;
+			cm.faces[25].flag |= CF_CONSTRAINED;
  			cm.faces[25].theta=6.3;
 			cm.faces[50].flag |= CF_CONSTRAINED;
 			cm.faces[50].theta=3.346;
@@ -247,15 +247,24 @@
 
 			//TODO Get efficient and correct way to mark edges of cut graph
 
-			for(a=0;a<totedge;a++)
+/*			for(a=0;a<totedge;a++)
 				if(!(cm.edges[a].flag &	CE_MARKED))
 					{
 					printf("Edge not marked: %d\n",cm.edges[a].index);
 					medge[a].flag |=ME_SHARP;
 					}
-
+*/
 			
 			generateDirectionField(&cm);
+			generateParametrization(&cm,0.5);
+
+				for(a=0;a<totedge;a++)
+				if(!(cm.edges[a].flag &	CE_MARKED))
+					{
+					printf("Edge not marked: %d\n",cm.edges[a].index);
+					medge[a].flag |=ME_SHARP;
+					}
+
 			
 	// Extract face angles, period jumps and other relevant data from the mesh
 	





More information about the Bf-blender-cvs mailing list