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

OCCFace::containsPoint() did not correctly take orientation of edge loop
into account (fixes bug reported by Jacques Kools about cross in OCC plane
faces not drawn)
parent 975ccd20
No related branches found
No related tags found
No related merge requests found
// $Id: GFace.cpp,v 1.37 2007-09-24 08:14:29 geuzaine Exp $ // $Id: GFace.cpp,v 1.38 2007-10-16 20:00:06 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -92,9 +92,9 @@ std::list<GVertex*> GFace::vertices() const ...@@ -92,9 +92,9 @@ std::list<GVertex*> GFace::vertices() const
while (it != l_edges.end()){ while (it != l_edges.end()){
GVertex *v1 = (*it)->getBeginVertex(); GVertex *v1 = (*it)->getBeginVertex();
GVertex *v2 = (*it)->getEndVertex(); GVertex *v2 = (*it)->getEndVertex();
if(std::find(ret.begin(), ret.end(), v1) == ret.end()) if(v1 && std::find(ret.begin(), ret.end(), v1) == ret.end())
ret.push_back(v1); ret.push_back(v1);
if(std::find(ret.begin(), ret.end(), v2) == ret.end()) if(v2 && std::find(ret.begin(), ret.end(), v2) == ret.end())
ret.push_back(v2); ret.push_back(v2);
++it; ++it;
} }
......
// $Id: OCCFace.cpp,v 1.22 2007-03-16 10:03:40 remacle Exp $ // $Id: OCCFace.cpp,v 1.23 2007-10-16 20:00:06 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -70,7 +70,8 @@ OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape ...@@ -70,7 +70,8 @@ OCCFace::OCCFace(GModel *m, TopoDS_Face _s, int num, TopTools_IndexedMapOfShape
_periodic[1] = surface.IsVPeriodic(); _periodic[1] = surface.IsVPeriodic();
ShapeAnalysis::GetFaceUVBounds(_s, umin, umax, vmin, vmax); ShapeAnalysis::GetFaceUVBounds(_s, umin, umax, vmin, vmax);
Msg(DEBUG2, "OCC Face %d with %d edges bounds (%g,%g)(%g,%g)", num, l_edges.size(),umin,umax,vmin,vmax); Msg(DEBUG2, "OCC Face %d with %d edges bounds (%g,%g)(%g,%g)",
num, l_edges.size(),umin,umax,vmin,vmax);
// we do that for the projections to converge on the // we do that for the projections to converge on the
// borders of the surface // borders of the surface
const double du = umax-umin; const double du = umax-umin;
...@@ -204,21 +205,29 @@ int OCCFace::containsPoint(const SPoint3 &pt) const ...@@ -204,21 +205,29 @@ int OCCFace::containsPoint(const SPoint3 &pt) const
{ {
if(geomType() == Plane){ if(geomType() == Plane){
gp_Pln pl = Handle(Geom_Plane)::DownCast(occface)->Pln(); gp_Pln pl = Handle(Geom_Plane)::DownCast(occface)->Pln();
// OK to use the normal from the mean plane here: we compensate
// for the (possibly wrong) orientation at the end
double n[3], c; double n[3], c;
pl.Coefficients(n[0], n[1], n[2], c); pl.Coefficients(n[0], n[1], n[2], c);
norme(n); norme(n);
double angle = 0.; double angle = 0.;
double v[3] = {pt.x(), pt.y(), pt.z()}; double v[3] = {pt.x(), pt.y(), pt.z()};
std::list<int>::const_iterator ito = l_dirs.begin();
for(std::list<GEdge*>::const_iterator it = l_edges.begin(); it != l_edges.end(); it++){ for(std::list<GEdge*>::const_iterator it = l_edges.begin(); it != l_edges.end(); it++){
GEdge *c = *it; GEdge *c = *it;
int ori = 1;
if(ito != l_dirs.end()){
ori = *ito;
++ito;
}
int N = 10; int N = 10;
Range<double> range = c->parBounds(0); Range<double> range = c->parBounds(0);
for(int j = 0; j < N ; j++) { for(int j = 0; j < N ; j++) {
double u1 = (double)j / (double)N; double u1 = (double)j / (double)N;
double u2 = (double)(j + 1) / (double)N; double u2 = (double)(j + 1) / (double)N;
if(ori < 0){
u1 = 1. - u1;
u2 = 1. - u2;
}
GPoint pp1 = c->point(range.low() + u1 * (range.high() - range.low())); GPoint pp1 = c->point(range.low() + u1 * (range.high() - range.low()));
GPoint pp2 = c->point(range.low() + u2 * (range.high() - range.low())); GPoint pp2 = c->point(range.low() + u2 * (range.high() - range.low()));
double v1[3] = {pp1.x(), pp1.y(), pp1.z()}; double v1[3] = {pp1.x(), pp1.y(), pp1.z()};
......
// $Id: meshGFace.cpp,v 1.98 2007-10-14 19:54:16 remacle Exp $ // $Id: meshGFace.cpp,v 1.99 2007-10-16 20:00:07 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -1820,7 +1820,7 @@ void meshGFace::operator() (GFace *gf) ...@@ -1820,7 +1820,7 @@ void meshGFace::operator() (GFace *gf)
// temp fix until we create MEdgeLoops in gmshFace // temp fix until we create MEdgeLoops in gmshFace
Msg(DEBUG1, "Generating the mesh"); Msg(DEBUG1, "Generating the mesh");
if(gf->getNativeType() == GEntity::GmshModel || gf->edgeLoops.empty()){ if(gf->getNativeType() == GEntity::GmshModel || gf->edgeLoops.empty()){
gmsh2DMeshGenerator(gf,0, true); gmsh2DMeshGenerator(gf,0, false);
} }
else{ else{
if(!gmsh2DMeshGeneratorPeriodic(gf,false)) if(!gmsh2DMeshGeneratorPeriodic(gf,false))
......
...@@ -225,7 +225,7 @@ Plane Surface(11) = {9,10}; ...@@ -225,7 +225,7 @@ Plane Surface(11) = {9,10};
Point(9999) = {0.6,0,0,1}; Point(9999) = {0.6,0,0,1};
Attractor Point{9999} = {0.2,0.02,lc3*10,2}; //Attractor Point{9999} = {0.2,0.02,lc3*10,2};
//Attractor Line{1,2,3,4} = {1,.05,3}; //Attractor Line{1,2,3,4} = {1,.05,3};
//Mesh.Algorithm = 2; //Mesh.Algorithm = 2;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment