Skip to content
Snippets Groups Projects
Commit cb192665 authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

fixed BL orientation

parent fcfe3916
No related branches found
No related tags found
No related merge requests found
...@@ -260,26 +260,51 @@ void transferDataStructure(GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris, ...@@ -260,26 +260,51 @@ void transferDataStructure(GFace *gf, std::set<MTri3*, compareTri3Ptr> &AllTris,
// parameter space (it would be nicer to change the actual algorithm // parameter space (it would be nicer to change the actual algorithm
// to ensure that we create correctly-oriented triangles in the // to ensure that we create correctly-oriented triangles in the
// first place) // first place)
// if BL triangles are considered, then all that is WRONG !
if(gf->triangles.size() > 1){ if(gf->triangles.size() > 1){
bool BL = !gf->getColumns()->_toFirst.empty();
double n1[3], n2[3]; double n1[3], n2[3];
MTriangle *t = gf->triangles[0]; MTriangle *t = gf->triangles[0];
MVertex *v0 = t->getVertex(0), *v1 = t->getVertex(1), *v2 = t->getVertex(2); MVertex *v0 = t->getVertex(0), *v1 = t->getVertex(1), *v2 = t->getVertex(2);
if (!BL){
int index0 = data.getIndex (v0); int index0 = data.getIndex (v0);
int index1 = data.getIndex (v1); int index1 = data.getIndex (v1);
int index2 = data.getIndex (v2); int index2 = data.getIndex (v2);
normal3points(data.Us[index0], data.Vs[index0], 0., normal3points(data.Us[index0], data.Vs[index0], 0.,
data.Us[index1], data.Vs[index1], 0., data.Us[index1], data.Vs[index1], 0.,
data.Us[index2], data.Vs[index2], 0., n1); data.Us[index2], data.Vs[index2], 0., n1);
}
else {
// BL --> PLANAR FACES !!!
normal3points(v0->x(),v0->y(),v0->z(),
v1->x(),v1->y(),v1->z(),
v2->x(),v2->y(),v2->z(), 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];
v0 = t->getVertex(0); v1 = t->getVertex(1); v2 = t->getVertex(2); v0 = t->getVertex(0); v1 = t->getVertex(1); v2 = t->getVertex(2);
index0 = data.getIndex (v0); if (!BL){
index1 = data.getIndex (v1); int index0 = data.getIndex (v0);
index2 = data.getIndex (v2); int index1 = data.getIndex (v1);
int index2 = data.getIndex (v2);
normal3points(data.Us[index0], data.Vs[index0], 0., normal3points(data.Us[index0], data.Vs[index0], 0.,
data.Us[index1], data.Vs[index1], 0., data.Us[index1], data.Vs[index1], 0.,
data.Us[index2], data.Vs[index2], 0., n2); data.Us[index2], data.Vs[index2], 0., n2);
}
else {
// BL --> PLANAR FACES !!!
normal3points(v0->x(),v0->y(),v0->z(),
v1->x(),v1->y(),v1->z(),
v2->x(),v2->y(),v2->z(), n2);
}
double pp; prosca(n1, n2, &pp); double pp; prosca(n1, n2, &pp);
// orient the bignou
if(pp < 0) t->reverse(); if(pp < 0) t->reverse();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment