[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30352] branches/soc-2010-rohith291991: Updates to half edge DS.
Rohith B V
rohith291991 at gmail.com
Thu Jul 15 01:28:46 CEST 2010
Revision: 30352
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30352
Author: rohith291991
Date: 2010-07-15 01:28:44 +0200 (Thu, 15 Jul 2010)
Log Message:
-----------
Updates to half edge DS.
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-14 22:16:56 UTC (rev 30351)
+++ branches/soc-2010-rohith291991/intern/comiso/extern/CMesh.h 2010-07-14 23:28:44 UTC (rev 30352)
@@ -85,15 +85,40 @@
}CMesh;
+typedef struct HVert
+ {
+ 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;
+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
+
+ }HFace;
+
typedef struct HEdge
{
- Hvert* vertex; // vertex at the end of the half-edge
- Hedge* opposite; // oppositely oriented adjacent half-edge
- Hface* face; // face the half-edge borders
- Hedge* next; // next half-edge around the face
- Hedge* previous; // next 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]
@@ -105,39 +130,15 @@
int tvar;
int test;
double kappa;//Correction angle between two adjacent faces
- int index; //Index of the edge
+ 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 HVert
- {
- double co[3]; //coordinates of the vertex
- 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;
-typedef struct HFace
- {
- 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
-
- }HFace;
-
typedef struct HMesh
{
Modified: branches/soc-2010-rohith291991/intern/comiso/extern/uv.h
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/extern/uv.h 2010-07-14 22:16:56 UTC (rev 30351)
+++ branches/soc-2010-rohith291991/intern/comiso/extern/uv.h 2010-07-14 23:28:44 UTC (rev 30352)
@@ -8,7 +8,7 @@
#endif
void mi_quad_param(CMesh *mesh,double n_quads);
-void copyHC(HMesh hm, CMesh cm);
+void copyHC(HMesh *hm, CMesh *cm);
#ifdef __cplusplus
}
Modified: branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp 2010-07-14 22:16:56 UTC (rev 30351)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp 2010-07-14 23:28:44 UTC (rev 30352)
@@ -748,7 +748,7 @@
for(int i=0;i<mesh->numVerts;i++)
{
- mesh->verts[i].flag &= !CV_VISITED;
+
if(mesh->verts[i].flag & CV_LEAF)
{
mesh->verts[i].flag|= CV_VISITED;
Modified: branches/soc-2010-rohith291991/intern/comiso/intern/uv.cpp
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/uv.cpp 2010-07-14 22:16:56 UTC (rev 30351)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/uv.cpp 2010-07-14 23:28:44 UTC (rev 30352)
@@ -2,6 +2,8 @@
#include "ConstrainedSolver.h"
#include "MISolver.h"
#include "../extern/CMesh.h"
+#include "../extern/uv.h"
+#include "MEM_guardedalloc.h"
#include "Geometry"
#include <math.h>
@@ -20,6 +22,7 @@
}
+/*
void compute_edge_flux(HMesh *mesh, bool curl_correction = false) { //with optional curl correction
@@ -122,7 +125,7 @@
//sum to 0. Intuitively, all the entering flux should also get out.
//TODO Mainly untested and probably buggy
-/*
+
//mean of the fluxes per edge
int nvar = 0 ;
@@ -219,137 +222,189 @@
uflux[hi] = usign[hi]*x[uvar[hi]] ;
vflux[hi] = vsign[hi]*x[vvar[hi]] ;
}
- }*/
-}
-extern "C"
-void copyHC(HMesh hm, CMesh cm)
+ }
+}*/
+
+
+void copyHC(HMesh *hm, CMesh *cm)
{
int totedge,totface,totvert;
- totvert=cm.numVerts;
- totedge=cm.numEdges;
- totface=cm.numFaces;
+ totvert=cm->numVerts;
+ totedge=cm->numEdges;
+ totface=cm->numFaces;
+
int i=0;
- hm.numEdges=totedge*2;
- hm.numFaces=totface;
- hm.numVerts=totvert;
- hm.edges=MEM_mallocN((sizeof(HEdge)*(totedge*2)),"edges");
- hm.verts=MEM_mallocN((sizeof(HVert)*(totvert)),"verts");
- hm.faces=MEM_mallocN((sizeof(HFace)*(totface)),"faces");
+ hm->numEdges=totedge*2;
+ hm->numFaces=totface;
+ hm->numVerts=totvert;
- for(i=0;i<hm.numFaces;i++)
+ hm->edges=(HEdge *)MEM_mallocN((sizeof(HEdge)*(totedge*2)),"edges");
+ hm->verts=(HVert *)MEM_mallocN((sizeof(HVert)*(totvert)),"verts");
+ hm->faces=(HFace *)MEM_mallocN((sizeof(HFace)*(totface)),"faces");
+
+
+ for(i=0;i<hm->numFaces;i++)
{
- hm.faces[i].edge=NULL;
- hm.faces[i].index=i;
- hm.faces[i].flag;=cm.faces[i].flag;
- hm.faces[i].theta=cm.faces[i].theta;
+ hm->faces[i].edge=NULL;
+ hm->faces[i].index=i;
+ hm->faces[i].flag=cm->faces[i].flag;
+ hm->faces[i].theta=cm->faces[i].theta;
}
for(i=0;i<totedge;i++)
{
- hm.edges[2*i].index=2*i;
- hm.edges[2*i+1].index=2*i+1;
- hm.edges[2*i].flag=cm.edges[i].flag;
- hm.edges[2*i+1].flag=cm.edges[i].flag;
- hm.edges[2*i].kappa=cm.edges[i].kappa;
- hm.edges[2*i+1].kappa=-cm.edges[i].kappa;
- hm.edges[2*i].p=cm.edges[i].p;
- hm.edges[2*i+1].p=cm.edges[i].p;
+ hm->edges[2*i].index=2*i;
+ hm->edges[2*i+1].index=2*i+1;
+ hm->edges[2*i].flag=cm->edges[i].flag;
+ hm->edges[2*i+1].flag=cm->edges[i].flag;
+ hm->edges[2*i].kappa=cm->edges[i].kappa;
+ hm->edges[2*i+1].kappa=-cm->edges[i].kappa;
+ hm->edges[2*i].p=cm->edges[i].p;
+ hm->edges[2*i+1].p=cm->edges[i].p;
}
- for(i=0;i<hm.numEdges;i++)
+ for(i=0;i<hm->numEdges;i++)
{
- hm.edges[i].prev=NULL;
- hm.edges[i].next=NULL;
- hm.edges[i].vertex=NULL;
- hm.edges[i].opposite=NULL;
- hm.edges[i].face=NULL;
+ hm->edges[i].prev=NULL;
+ hm->edges[i].next=NULL;
+ hm->edges[i].vertex=NULL;
+ hm->edges[i].opposite=NULL;
+ hm->edges[i].face=NULL;
- hm.edges[i].uflux=0;
- hm.edges[i].vflux=0;
- hm.edges[i].usign=1;
- hm.edges[i].vsign=1;
- hm.edges[i].uvar=-1;
- hm.edges[i].vvar=-1;
- hm.edges[i].tvar=-1;
- hm.edges[i].test=-1;
+ hm->edges[i].uflux=0;
+ hm->edges[i].vflux=0;
+ hm->edges[i].usign=1;
+ hm->edges[i].vsign=1;
+ hm->edges[i].uvar=-1;
+ hm->edges[i].vvar=-1;
+ hm->edges[i].tvar=-1;
+ hm->edges[i].test=-1;
}
for(i=0;i<totvert;i++)
{
- hm.verts[i].co[0]=cm.verts[i].co[0];
- hm.verts[i].co[1]=cm.verts[i].co[1];
- hm.verts[i].co[2]=cm.verts[i].co[2];
- hm.verts[i].index=i;
- hm.verts[i].flag=cm.verts[i].flag;
- hm.verts[i].u=0;
- hm.verts[i].v=0;
+ hm->verts[i].co[0]=cm->verts[i].co[0];
+ hm->verts[i].co[1]=cm->verts[i].co[1];
+ hm->verts[i].co[2]=cm->verts[i].co[2];
+ hm->verts[i].index=i;
+ hm->verts[i].flag=cm->verts[i].flag;
+ hm->verts[i].u=0;
+ hm->verts[i].v=0;
}
+
+int ec=0;
for (int j=0;j<totface;j++)
{
int v[3];
int e[3];
- v[0]=cm.faces[j].v[0];
- v[1]=cm.faces[j].v[1];
- v[2]=cm.faces[j].v[2];
+ int n[3];
+ v[0]=cm->faces[j].v[0];
+ v[1]=cm->faces[j].v[1];
+ v[2]=cm->faces[j].v[2];
+
+
for (int t=0; t<3;t++)
{
- if((cm.faces[j].v[2]==cm[cm.edges[t]].v[0]] && cm.faces[j].v[1]==cm[cm.edges[t]].v[0]] )||
- (cm.faces[j].v[1]==cm[cm.edges[t]].v[1]] && cm.faces[j].v[2]==cm[cm.edges[t]].v[0]] ))
+
+
+ int index=cm->faces[j].edges[t];
+
+ if((cm->faces[j].v[2]==cm->edges[index].v[1] && cm->faces[j].v[1]==cm->edges[index].v[0] )||
+ (cm->faces[j].v[1]==cm->edges[index].v[1] && cm->faces[j].v[2]==cm->edges[index].v[0] ))
{
- e[0]=cm.edges[t].index;
+ // printf("tests\set\n");
+ e[0]=cm->faces[j].edges[t];
+ n[0]=cm->faces[j].neighbors[t];
}
- else if((cm.faces[j].v[1]==cm[cm.edges[t]].v[0]] && cm.faces[j].v[0]==cm[cm.edges[t]].v[0]] )||
- (cm.faces[j].v[0]==cm[cm.edges[t]].v[1]] && cm.faces[j].v[1]==cm[cm.edges[t]].v[0]] ))
+ else if((cm->faces[j].v[1]==cm->edges[index].v[1] && cm->faces[j].v[0]==cm->edges[index].v[0] )||
+ (cm->faces[j].v[0]==cm->edges[index].v[1] && cm->faces[j].v[1]==cm->edges[index].v[0] ))
{
- e[1]=cm.edges[t].index;
+
+ e[1]=cm->faces[j].edges[t];
+ n[1]=cm->faces[j].neighbors[t];
}
- else if((cm.faces[j].v[0]==cm[cm.edges[t]].v[0]] && cm.faces[j].v[2]==cm[cm.edges[t]].v[0]] )||
- (cm.faces[j].v[2]==cm[cm.edges[t]].v[1]] && cm.faces[j].v[0]==cm[cm.edges[t]].v[0]] ))
+ else if((cm->faces[j].v[0]==cm->edges[index].v[1] && cm->faces[j].v[2]==cm->edges[index].v[0] )||
+ (cm->faces[j].v[2]==cm->edges[index].v[1] && cm->faces[j].v[0]==cm->edges[index].v[0] ))
{
- e[2]=cm.edges[t].index;
+
+ e[2]=cm->faces[j].edges[t];
+ n[2]=cm->faces[j].neighbors[t];
}
+
}
- hm.faces[j].edge=&hm.edges[3*j];
+ hm->faces[j].edge=&hm->edges[ec];
for(int t=0;t<3;t++)
{
- hm.edges[3*j+t].face=&hm.faces[j];
- hm.edges[3*j+t].prev=&hm.edges[3*j+(t+2)%3];
- hm.edges[3*j+t].next=&hm.edges[3*j+(t+1)%3];
- hm.edges[3*j+t].flag=cm.edges[e[t]].flag;
- hm.edges[3*j+t].vertex=&hm.verts[cm.faces[j].v[2-t]];
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list