[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29802] branches/soc-2010-rohith291991: Additions to Cmesh.
Rohith B V
rohith291991 at gmail.com
Tue Jun 29 22:35:18 CEST 2010
Revision: 29802
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29802
Author: rohith291991
Date: 2010-06-29 22:35:17 +0200 (Tue, 29 Jun 2010)
Log Message:
-----------
Additions to Cmesh.
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/normal_cycle.cpp
branches/soc-2010-rohith291991/intern/comiso/intern/normal_cycle.h
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-06-29 19:44:14 UTC (rev 29801)
+++ branches/soc-2010-rohith291991/intern/comiso/extern/CMesh.h 2010-06-29 20:35:17 UTC (rev 29802)
@@ -68,6 +68,7 @@
int generateVoronoiCells(CMesh * mesh);
int generateDirectionField(CMesh *mesh);
+int generateParametrization(CMesh *mesh,double h);
#ifdef __cplusplus
}
Modified: branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp 2010-06-29 19:44:14 UTC (rev 29801)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/CMesh.cpp 2010-06-29 20:35:17 UTC (rev 29802)
@@ -2,6 +2,7 @@
#include <vector>
#include <math.h>
#include "MEM_guardedalloc.h"
+#include "normal_cycle.h"
int generateVoronoiCells(CMesh* mesh)
{
@@ -184,10 +185,6 @@
int t=0;
-//TODO set solver.mdata
-//the variables are stored as all thetas followed by all period jumps
-
-
//TODO makes constraints on face theta's
//call generateConstraints(CMesh* mesh)
@@ -213,13 +210,15 @@
t++;
- double x1,x2,y1,y2,z1,z2;
+ double x1,x2,y1,y2,z1,z2,x3,y3,z3;
- int v1,v2,v3,v4;
+ int v1,v2,v3,v4,v5,v6;
v1=mesh->faces[i].v[0];
v2=mesh->faces[i].v[1];
v3=mesh->edges[mesh->faces[i].edges[j]].v[0];
v4=mesh->edges[mesh->faces[i].edges[j]].v[1];
+ v5=mesh->faces[j].v[0];
+ v6=mesh->faces[j].v[1];
x1=mesh->verts[v1].co[0]-mesh->verts[v2].co[0];
@@ -230,9 +229,13 @@
y2=mesh->verts[v3].co[1]-mesh->verts[v4].co[1];
z2=mesh->verts[v3].co[2]-mesh->verts[v4].co[2];
+ x3=mesh->verts[v5].co[0]-mesh->verts[v6].co[0];
+ y3=mesh->verts[v5].co[1]-mesh->verts[v6].co[1];
+ z3=mesh->verts[v5].co[2]-mesh->verts[v6].co[2];
+
//TODO calculate correct kappa
- mesh->edges[mesh->faces[i].edges[j]].kappa=acos((x1*x2+y1*y2+z1*z2)/sqrt((x1*x1+y1*y1+z1*z1)*(x2*x2+y2*y2+z2*z2)));
+ mesh->edges[mesh->faces[i].edges[j]].kappa=acos((x1*x2+y1*y2+z1*z2)/sqrt((x1*x1+y1*y1+z1*z1)*(x2*x2+y2*y2+z2*z2)))-acos((x3*x2+y3*y2+z3*z2)/sqrt((x3*x3+y3*y3+z3*z3)*(x2*x2+y2*y2+z2*z2)));
totkappa+= mesh->edges[mesh->faces[i].edges[j]].kappa;
solver.mdata[t].i=i;
@@ -381,3 +384,52 @@
return 1;
}
+
+//TODO
+int generateParametrization(CMesh *mesh,double h)
+{
+
+double totarea=0;
+Comiso solver;
+int totedge,totface,totvert;
+totvert=mesh->numVerts;
+totedge=mesh->numEdges;
+totface=mesh->numFaces;
+
+for(int i=0;i<totface;i++)
+ {
+
+ double x1,y1,z1,x2,y2,z2;
+ double ux,uy,uz,vx,vy,vz;
+ ux=0;
+ uy=0;
+ uz=0;
+ vx=0;
+ vy=0;
+ vz=0;
+
+ double energy=0;
+ int e1,e2;
+ e1=mesh->faces[i].edges[0];
+ e2=mesh->faces[i].edges[1];
+
+ x1=mesh->edges[e1].v[1].co[0]-mesh->edges[e1].v[0].co[0];
+ y1=mesh->edges[e1].v[1].co[1]-mesh->edges[e1].v[0].co[1];
+ z1=mesh->edges[e1].v[1].co[2]-mesh->edges[e1].v[0].co[2];
+ x2=mesh->edges[e2].v[1].co[0]-mesh->edges[e1].v[0].co[0];
+ y2=mesh->edges[e2].v[1].co[1]-mesh->edges[e1].v[0].co[1];
+ z2=mesh->edges[e2].v[1].co[2]-mesh->edges[e1].v[0].co[2];
+
+ x1 y1 z1
+ x2 y2 z2
+ i j k
+
+ 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;
+
+
+ }
+
+}
\ No newline at end of file
Modified: branches/soc-2010-rohith291991/intern/comiso/intern/normal_cycle.cpp
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/normal_cycle.cpp 2010-06-29 19:44:14 UTC (rev 29801)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/normal_cycle.cpp 2010-06-29 20:35:17 UTC (rev 29802)
@@ -34,7 +34,7 @@
* the Software into proprietary programs.
*/
-#include "../extern/normal_cycle.h>"
+#include "normal_cycle.h"
namespace OGF {
@@ -58,11 +58,12 @@
M_[0] += s ;
M_[2] += s ;
M_[5] += s ;
-
-
+
double eigen_vectors[9] ;
- MatrixUtil::semi_definite_symmetric_eigen(M_, 3, eigen_vectors, eigen_value_) ;
-
+
+ //TODO
+ // MatrixUtil::semi_definite_symmetric_eigen(M_, 3, eigen_vectors, eigen_value_);
+
axis_[0] = Vector3d(
eigen_vectors[0], eigen_vectors[1], eigen_vectors[2]
) ;
Modified: branches/soc-2010-rohith291991/intern/comiso/intern/normal_cycle.h
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/normal_cycle.h 2010-06-29 19:44:14 UTC (rev 29801)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/normal_cycle.h 2010-06-29 20:35:17 UTC (rev 29802)
@@ -38,10 +38,8 @@
#ifndef __MESH_TOOLS_MATH_NORMAL_CYCLE__
#define __MESH_TOOLS_MATH_NORMAL_CYCLE__
-#include <OGF/math/common/common.h>
-#include <OGF/math/geometry/types.h>
+#include "common.h"
-
template <class T> inline void ogf_swap(T& x, T& y) {
T z = x ;
x = y ;
@@ -60,7 +58,7 @@
* D. Cohen-Steiner and J.M. Morvan,
* SOCG 2003
*/
- class MATH_API NormalCycle {
+ class NormalCycle {
public:
NormalCycle() ;
void begin() ;
Modified: branches/soc-2010-rohith291991/source/blender/modifiers/intern/MOD_quadrangulate.c
===================================================================
--- branches/soc-2010-rohith291991/source/blender/modifiers/intern/MOD_quadrangulate.c 2010-06-29 19:44:14 UTC (rev 29801)
+++ branches/soc-2010-rohith291991/source/blender/modifiers/intern/MOD_quadrangulate.c 2010-06-29 20:35:17 UTC (rev 29802)
@@ -228,10 +228,15 @@
}
cm.faces[3].flag |= CF_CONSTRAINED;
+ cm.faces[3].theta=1.3;
cm.faces[10].flag |= CF_CONSTRAINED;
-/* cm.faces[25].flag |= CF_CONSTRAINED;
+ cm.faces[10].theta=2.35;
+cm.faces[25].flag |= CF_CONSTRAINED;
+ cm.faces[25].theta=6.3;
cm.faces[50].flag |= CF_CONSTRAINED;
- cm.faces[73].flag |= CF_CONSTRAINED;*/
+ cm.faces[50].theta=3.346;
+ cm.faces[73].flag |= CF_CONSTRAINED;
+ cm.faces[73].theta=0.335;
generateVoronoiCells(&cm);
More information about the Bf-blender-cvs
mailing list