Skip to content
Snippets Groups Projects
Commit fb563544 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better code for consistent tri orientation

parent c4a07b59
No related branches found
No related tags found
No related merge requests found
...@@ -646,7 +646,8 @@ void gmshBowyerWatson(GFace *gf) ...@@ -646,7 +646,8 @@ void gmshBowyerWatson(GFace *gf)
Vs[base->getVertex(2)->getNum()]) / 3.}; Vs[base->getVertex(2)->getNum()]) / 3.};
buildMetric(gf, pa, metric); buildMetric(gf, pa, metric);
circumCenterMetric(worst->tri(), metric, Us, Vs, center, r2); circumCenterMetric(worst->tri(), metric, Us, Vs, center, r2);
insertAPoint(gf,AllTris.begin(),center,metric,Us,Vs,vSizes,vSizesBGM,AllTris); insertAPoint(gf, AllTris.begin(), center, metric, Us, Vs, vSizes, vSizesBGM,
AllTris);
} }
// if(ITER % 10== 0){ // if(ITER % 10== 0){
// char name[245]; // char name[245];
...@@ -654,7 +655,7 @@ void gmshBowyerWatson(GFace *gf) ...@@ -654,7 +655,7 @@ void gmshBowyerWatson(GFace *gf)
// _printTris (name, AllTris, Us,Vs,false); // _printTris (name, AllTris, Us,Vs,false);
// } // }
} }
transferDataStructure(gf, AllTris); transferDataStructure(gf, AllTris, Us, Vs);
} }
/* /*
...@@ -792,5 +793,5 @@ void gmshBowyerWatsonFrontal(GFace *gf) ...@@ -792,5 +793,5 @@ void gmshBowyerWatsonFrontal(GFace *gf)
// char name[245]; // char name[245];
// sprintf(name,"frontal%d.pos", gf->tag()); // sprintf(name,"frontal%d.pos", gf->tag());
// _printTris (name, AllTris, Us, Vs); // _printTris (name, AllTris, Us, Vs);
transferDataStructure(gf, AllTris); transferDataStructure(gf, AllTris, Us, Vs);
} }
...@@ -93,7 +93,8 @@ void buildMeshGenerationDataStructures(GFace *gf, ...@@ -93,7 +93,8 @@ void buildMeshGenerationDataStructures(GFace *gf,
connectTriangles(AllTris); connectTriangles(AllTris);
} }
void transferDataStructure(GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris) void transferDataStructure(GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris,
std::vector<double> &Us, std::vector<double> &Vs)
{ {
while (1) { while (1) {
if (AllTris.begin() == AllTris.end()) break; if (AllTris.begin() == AllTris.end()) break;
...@@ -106,26 +107,23 @@ void transferDataStructure(GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris) ...@@ -106,26 +107,23 @@ void transferDataStructure(GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris)
AllTris.erase(AllTris.begin()); AllTris.erase(AllTris.begin());
} }
// make sure all the triangles are oriented in the same way (in // make sure all the triangles are oriented in the same way in
// parameter space). FIXME: this is really ugly and slow. JF: we // parameter space (it would be nicer to change the actual algorithm
// need to change the actual algorithm to ensure that we create // to ensure that we create correctly-oriented triangles in the
// correctly oriented triangles in the first place // first place)
if(gf->triangles.size() > 1){ if(gf->triangles.size() > 1){
double u[3], v[3], n1[3], n2[3]; double n1[3], n2[3];
MTriangle *t = gf->triangles[0]; MTriangle *t = gf->triangles[0];
SPoint2 uv[3]; MVertex *v0 = t->getVertex(0), *v1 = t->getVertex(1), *v2 = t->getVertex(2);
for(int i = 0; i < 3; i++) normal3points(Us[v0->getNum()], Vs[v0->getNum()], 0.,
reparamMeshVertexOnFace(t->getVertex(i), gf, uv[i]); Us[v1->getNum()], Vs[v1->getNum()], 0.,
normal3points(uv[0].x(), uv[0].y(), 0., Us[v2->getNum()], Vs[v2->getNum()], 0., n1);
uv[1].x(), uv[1].y(), 0.,
uv[2].x(), uv[2].y(), 0., n1);
for(unsigned int j = 1; j < gf->triangles.size(); j++){ for(unsigned int j = 1; j < gf->triangles.size(); j++){
t = gf->triangles[j]; t = gf->triangles[j];
for(int i = 0; i < 3; i++) v0 = t->getVertex(0); v1 = t->getVertex(1); v2 = t->getVertex(2);
reparamMeshVertexOnFace(t->getVertex(i), gf, uv[i]); normal3points(Us[v0->getNum()], Vs[v0->getNum()], 0.,
normal3points(uv[0].x(), uv[0].y(), 0., Us[v1->getNum()], Vs[v1->getNum()], 0.,
uv[1].x(), uv[1].y(), 0., Us[v2->getNum()], Vs[v2->getNum()], 0., n2);
uv[2].x(), uv[2].y(), 0., n2);
double pp; prosca(n1, n2, &pp); double pp; prosca(n1, n2, &pp);
if(pp < 0) t->revert(); if(pp < 0) t->revert();
} }
......
...@@ -52,7 +52,8 @@ void buildMeshGenerationDataStructures(GFace *gf, ...@@ -52,7 +52,8 @@ void buildMeshGenerationDataStructures(GFace *gf,
std::vector<double> &vSizesBGM, std::vector<double> &vSizesBGM,
std::vector<double> &Us, std::vector<double> &Us,
std::vector<double> &Vs); std::vector<double> &Vs);
void transferDataStructure (GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris); void transferDataStructure(GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris,
std::vector<double> &Us, std::vector<double> &Vs);
void gmshRecombineIntoQuads(GFace *gf); void gmshRecombineIntoQuads(GFace *gf);
struct swapquad{ struct swapquad{
......
$Id: VERSIONS.txt,v 1.39 2009-03-15 10:36:40 geuzaine Exp $ $Id: VERSIONS.txt,v 1.40 2009-03-16 07:23:48 geuzaine Exp $
(?): removed GSL dependency (Gmsh now simply requires Blas and (?): removed GSL dependency (Gmsh now simply requires Blas and
Lapack); new per-window visibility; added support for composite window Lapack); new per-window visibility; added support for composite window
printing and background images; fixes for string options in parser; printing and background images; fixes for string options in parser;
fixed surface mesh orientation for Open Cascade models. fixed surface mesh orientation for Open Cascade models; fixed triangle
orientations in Delaunay and Frontal algorithms.
2.3.0 (Jan 23, 2009): major graphics and GUI code refactoring; new 2.3.0 (Jan 23, 2009): major graphics and GUI code refactoring; new
full-quad/hexa subdivision algorithm (removed Mesh.RecombineAlgo); full-quad/hexa subdivision algorithm (removed Mesh.RecombineAlgo);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment