[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30390] branches/soc-2010-rohith291991: Comments and cleanup phase 1.
Rohith B V
rohith291991 at gmail.com
Thu Jul 15 21:16:18 CEST 2010
Revision: 30390
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30390
Author: rohith291991
Date: 2010-07-15 21:16:17 +0200 (Thu, 15 Jul 2010)
Log Message:
-----------
Comments and cleanup phase 1.
Modified Paths:
--------------
branches/soc-2010-rohith291991/intern/comiso/extern/CMesh.h
branches/soc-2010-rohith291991/intern/comiso/extern/uv.h
branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp
branches/soc-2010-rohith291991/intern/comiso/intern/uv.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-15 18:41:29 UTC (rev 30389)
+++ branches/soc-2010-rohith291991/intern/comiso/extern/CMesh.h 2010-07-15 19:16:17 UTC (rev 30390)
@@ -9,6 +9,7 @@
//flags for CEdge
#define CE_MARKED (1)
+#define CE_SEAM (2)
//flags for CVert
#define CV_MARKED (1)
@@ -16,156 +17,144 @@
#define CV_VISITED (1<<3)
#define CV_LEAF (1<<4)
+//CMesh data structure
struct CFace;
struct CEdge;
struct CVert;
+
+//Halfedge Data Structure
struct HEdge;
struct HFace;
struct HVert;
typedef struct CVert
-{
+ {
-int * neighbors; //Indices of all neighboring vertices
-int * edges; //Indices of the edges, corresponding to neighbors
-int vvar; //Vertex duplications
-int index; //Index of the vertex
-int flag; //Flag for various purposes (if needed)
-int numNeighbors; //Number of neighboring vertices
-int pvert; //Parent vertex in Dijsktra
-float u; //u Parameter
-float v; //v Parameter
-float co[3]; //Coordinates of the vertex
+ int * neighbors; //Indices of all neighboring vertices
+ int * edges; //Indices of the edges, corresponding to neighbors
+ int vvar; //Vertex duplications
+ int index; //Index of the vertex
+ int flag; //Flag for various purposes (if needed)
+ int numNeighbors; //Number of neighboring vertices
+ int pvert; //Parent vertex in Dijsktra
+ float u; //u Parameter
+ float v; //v Parameter
+ float co[3]; //Coordinates of the vertex
-}CVert;
+ }CVert;
typedef struct CEdge{
-int faces[2];//Indices of all faces having this edge
-double uflux[2];//Flux of u through edge from face[0] to face[1]
-double vflux[2];//Flux of v through edge from face[0] to face[1]
-//Optimization variables
-int usign[2];
-int vsign[2];
-int uvar[2];
-int vvar[2];
-int tvar[2];
-int test[2];
-double kappa;//Correction angle between two adjacent faces
-int index; //Index of the edge
-int p;// Period Jump for v1-v2. For v2-v1 it is -p
-int flag; //Flag for various purposes (eg. Cut graph)
-int v[2]; // Indices of vertices
+ int faces[2];//Indices of all faces having this edge
+ double kappa;//Correction angle between two adjacent faces
+ int index; //Index of the edge
+ int p;// Period Jump for v1-v2. For v2-v1 it is -p
+ int flag; //Flag for various purposes (eg. Cut graph)
+ int v[2]; // Indices of vertices
-}CEdge;
+ }CEdge;
typedef struct CFace{
-int * neighbors; //Indices of all neighboring faces
-int * edges; //Indices of the edges, corresponding to neighbors
-int vvar[3]; //Vertex variable
-int index; //Index of the face
-int group; //Group index of the face
-int flag; //Flag for various purposes
-int numNeighbors; //Number of neighboring faces
-int v[4];// Indices of vertices. v4 is -1 if it is a triangle
-double theta; //Angle that the principle direction field makes with the edge represented by v1-v2
-double ut[3]; //Direction of u field
-double vt[3]; //Direction of v field
+ int * neighbors; //Indices of all neighboring faces
+ int * edges; //Indices of the edges, corresponding to neighbors
+ int index; //Index of the face
+ int group; //Group index of the face
+ int flag; //Flag for various purposes
+ int numNeighbors; //Number of neighboring faces
+ int v[4];// Indices of vertices. v4 is -1 if it is a triangle
+ double theta; //Angle that the principle direction field makes with the edge represented by v1-v2
-}CFace;
+ }CFace;
typedef struct CMesh
-{
+ {
-CVert* verts; //Vertex data
-CEdge * edges; //Edge data
-CFace * faces; //Face data
-int numFaces,numEdges,numVerts; // Self explanatory
+ CVert* verts; //Vertex data
+ CEdge * edges; //Edge data
+ CFace * faces; //Face data
+ int numFaces,numEdges,numVerts; // Self explanatory
-}CMesh;
+ }CMesh;
typedef struct HVert
- {
- double co[3]; //coordinates of the vertex
- struct HEdge* edge; //halfedge associated with the vertex (chosen as right)
+ {
+ double co[3]; //coordinates of the vertex
+ struct HEdge* edge; //halfedge associated with the vertex (chosen as right)
- int index; //Index of the vertex
- int flag; //Flag for various purposes (if needed)
- double u; //u Parameter
- double v; //v Parameter
-
- }HVert;
-
+ int index; //Index of the vertex
+ int flag; //Flag for various purposes (if needed)
+ double u; //u Parameter
+ double v; //v Parameter
+
+ }HVert;
+
typedef struct HFace
- {
+ {
struct HEdge* edge; //halfedge associated with the face (random)
double normal[3]; //normal (for direction purposes)
int index; //Index of the face
- //int group; //Group index of the face
int flag; //Flag for various purposes
double theta; //Angle that the principle direction field makes with the edge represented by v1-v2
double ut[3]; //Direction of u field
double vt[3]; //Direction of v field
int v[3]; //Redundancy
-
- }HFace;
+ }HFace;
+
typedef struct HEdge
- {
+ {
- HVert* vertex; // vertex at the end of the half-edge
- struct HEdge* opposite; // oppositely oriented adjacent half-edge
- HFace* face; // face the half-edge borders
- struct HEdge* next; // next half-edge around the face
- struct HEdge* prev; // previous half-edge around the face
+ HVert* vertex; // vertex at the end of the half-edge
+ struct HEdge* opposite; // oppositely oriented adjacent half-edge
+ HFace* face; // face the half-edge borders
+ struct HEdge* next; // next half-edge around the face
+ struct HEdge* prev; // previous half-edge around the face
- double uflux;//Flux of u through edge from face[0] to face[1]
- double vflux;//Flux of v through edge from face[0] to face[1]
- double je; //rotational extra 1
- double ke; //rotational extra 2
- double u; //Parametrization variable 1 (associated with vertex)
- double v; //Parametrization variable 2 (associated with vertex)
- //Optimization variables
- int usign;
- int vsign;
- int uvar;
- int vvar;
- int tvar;
- int test;
- int is_resp;
- double kappa;//Correction angle between two adjacent faces
- int index; //Index of the edge (from cmesh)
- int p;// Period Jump for v1-v2. For v2-v1 it is -p
- int flag; //Flag for various purposes (eg. Cut graph)
- //int v[2]; // Indices of vertices
-
- }HEdge;
+ double uflux;//Flux of u through edge from face[0] to face[1]
+ double vflux;//Flux of v through edge from face[0] to face[1]
+ double je; //rotational extra 1
+ double ke; //rotational extra 2
+ double u; //Parametrization variable 1 (associated with vertex)
+ double v; //Parametrization variable 2 (associated with vertex)
+ //Optimization variables
+ int usign;
+ int vsign;
+ int uvar;
+ int vvar;
+ int tvar; //Variable id of halfedge
+ int test; //To check if halfedge has a tvar
+ int is_resp; //Is the edge responsible
+ double kappa;//Correction angle between two adjacent faces
+ int index; //Index of the edge (from cmesh)
+ int p;// Period Jump for v1-v2. For v2-v1 it is -p
+ int flag; //Flag for various purposes (eg. Cut graph)
+ //int v[2]; // Indices of vertices
+ }HEdge;
-
typedef struct HMesh
-{
+ {
-HVert* verts; //Vertex data
-HEdge * edges; //Edge data
-HFace * faces; //Face data
-int numFaces,numEdges,numVerts; // Self explanatory
+ HVert* verts; //Vertex data
+ HEdge * edges; //Edge data
+ HFace * faces; //Face data
+ int numFaces,numEdges,numVerts; // Self explanatory
-}HMesh;
+ }HMesh;
-
+
#ifdef __cplusplus
extern "C" {
#endif
-int generateVoronoiCells(CMesh * mesh);
-int generateDirectionField(CMesh *mesh);
-int generateParametrization(CMesh *mesh,double h);
+ int generateVoronoiCells(CMesh * mesh);
+ int generateDirectionField(CMesh *mesh);
+ int generateParametrization(CMesh *mesh,double h);
#ifdef __cplusplus
- }
+ }
#endif
#endif
Modified: branches/soc-2010-rohith291991/intern/comiso/extern/uv.h
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/extern/uv.h 2010-07-15 18:41:29 UTC (rev 30389)
+++ branches/soc-2010-rohith291991/intern/comiso/extern/uv.h 2010-07-15 19:16:17 UTC (rev 30390)
@@ -7,11 +7,13 @@
extern "C" {
#endif
-void mi_quad_param(HMesh *hm);
-void copyHC(HMesh *hm, CMesh *cm);
+ //Solve for parametrization
+ void mi_quad_param(HMesh *hm);
+ //Copy mesh
+ void copyHC(HMesh *hm, CMesh *cm);
#ifdef __cplusplus
- }
+ }
#endif
#endif
\ No newline at end of file
Modified: branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp 2010-07-15 18:41:29 UTC (rev 30389)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp 2010-07-15 19:16:17 UTC (rev 30390)
@@ -5,12 +5,13 @@
#include "normal_cycle.h"
int generateVoronoiCells(CMesh* mesh)
-{
+ {
std::vector< std::vector <int> > currentFaces; //List of faces to expand for BFS/Dijkstra
int numCF=0; //Number of constrained faces
int j=0;
+ //Setup for BFS
for(int i=0;i<mesh->numFaces;i++)
if(mesh->faces[i].flag & CF_CONSTRAINED)
{
@@ -19,557 +20,514 @@
numCF++;
}
- currentFaces.resize(numCF);
+ currentFaces.resize(numCF);
- for(int i=0;i<mesh->numFaces;i++)
- if(mesh->faces[i].flag & CF_CONSTRAINED)
- {
- currentFaces[j].push_back(mesh->faces[i].index);
- j++;
- }
+ for(int i=0;i<mesh->numFaces;i++)
+ if(mesh->faces[i].flag & CF_CONSTRAINED)
+ {
+ currentFaces[j].push_back(mesh->faces[i].index);
+ j++;
+ }
-//Iterative BFS
-int terminate=1;
+ //Iterative BFS over dual from each constrained face
+ int terminate=1;
-while(terminate)
-{
+ while(terminate)
+ {
- terminate=0;
+ terminate=0;
- for(int i=0;i<numCF;i++)
- {
+ for(int i=0;i<numCF;i++)
+ {
- std::vector<int> newFaces;
- newFaces.resize(0);
+ std::vector<int> newFaces;
+ newFaces.resize(0);
- for(int j=0;j<currentFaces[i].size();j++)
- {
+ for(int j=0;j<currentFaces[i].size();j++)
+ {
- terminate++;
+ 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)||(mesh->faces[nIndex].group==face->group))
- {
+ int index=currentFaces[i][j];
+ CFace *face=&(mesh->faces[index]);
- if(!(mesh->faces[nIndex].flag & CF_VISITED))
- newFaces.push_back(nIndex);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list