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

fix orientation of surface mesh for OCC models

parent b97f687c
No related branches found
No related tags found
No related merge requests found
......@@ -1418,15 +1418,35 @@ void orientMeshGFace::operator()(GFace *gf)
if(gf->geomType() == GEntity::ProjectionFace) return;
// surface orientions in OCC are not consistent with the orientation
// of the bounding edges, so just leave them unchanged:
if(gf->getNativeType() == GEntity::OpenCascadeModel) return;
// in old versions we did not reorient transfinite surface meshes;
// we could add the following to provide backward compatibility:
// if(gf->meshAttributes.Method == MESH_TRANSFINITE) return;
// orients the mesh to match the orientation of the first edge
if(gf->getNativeType() == GEntity::OpenCascadeModel){
// surface orientions in OCC do not seem to be consistent with the
// orientation of the bounding edges, so we compare the normals
// pointwise in an element
for(int i = 0; i < gf->getNumMeshElements(); i++){
MElement *e = gf->getMeshElement(i);
for(int j = 0; j < e->getNumVertices(); j++){
MVertex *v = e->getVertex(j);
SPoint2 param;
if(reparamMeshVertexOnFace(v, gf, param)){
SVector3 ne = e->getFace(0).normal();
SVector3 nf = gf->normal(param);
if(dot(ne, nf) < 0){
Msg::Debug("Reverting orientation of mesh in face %d", gf->tag());
for(int k = 0; k < gf->getNumMeshElements(); k++)
gf->getMeshElement(k)->revert();
}
return;
}
}
}
Msg::Warning("Could not orient mesh in face %d", gf->tag());
}
else{
// orient the mesh to match the orientation of the first edge
std::list<GEdge*> edges = gf->edges();
std::list<int> ori = gf->orientations();
if(edges.empty() || ori.empty()) return;
......@@ -1446,3 +1466,4 @@ void orientMeshGFace::operator()(GFace *gf)
gf->quadrangles[i]->revert();
}
}
}
$Id: VERSIONS.txt,v 1.38 2009-03-13 08:04:38 geuzaine Exp $
$Id: VERSIONS.txt,v 1.39 2009-03-15 10:36:40 geuzaine Exp $
(?): removed GSL dependency (Gmsh now simply requires Blas and
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.
2.3.0 (Jan 23, 2009): major graphics and GUI code refactoring; new
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