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

fix crash on delete (Sphere_1.brep)

parent 6f5a2acf
No related branches found
No related tags found
No related merge requests found
...@@ -96,15 +96,16 @@ void GEdge::resetMeshAttributes() ...@@ -96,15 +96,16 @@ void GEdge::resetMeshAttributes()
meshAttributes.reverseMesh = false; meshAttributes.reverseMesh = false;
} }
void GEdge::addFace(GFace *e) void GEdge::addFace(GFace *f)
{ {
if (std::find(l_faces.begin(), l_faces.end(), e) == l_faces.end()) if(std::find(l_faces.begin(), l_faces.end(), f) == l_faces.end())
l_faces.push_back(e); l_faces.push_back(f);
} }
void GEdge::delFace(GFace *e) void GEdge::delFace(GFace *f)
{ {
l_faces.erase(std::find(l_faces.begin(), l_faces.end(), e)); std::list<GFace*>::iterator it = std::find(l_faces.begin(), l_faces.end(), f);
if(it != l_faces.end()) l_faces.erase(it);
} }
SBoundingBox3d GEdge::bounds() const SBoundingBox3d GEdge::bounds() const
......
...@@ -95,7 +95,8 @@ class GFace : public GEntity ...@@ -95,7 +95,8 @@ class GFace : public GEntity
// edges that bound the face // edges that bound the face
virtual std::list<GEdge*> edges() const { return l_edges; } virtual std::list<GEdge*> edges() const { return l_edges; }
virtual std::list<int> edgeOrientations() const { return l_dirs; } virtual std::list<int> edgeOrientations() const { return l_dirs; }
inline bool containsEdge (int iEdge) const { inline bool containsEdge (int iEdge) const
{
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)
if ((*it)->tag() == iEdge) return true; if ((*it)->tag() == iEdge) return true;
return false; return false;
......
...@@ -37,12 +37,14 @@ void GVertex::setPosition(GPoint &p) ...@@ -37,12 +37,14 @@ void GVertex::setPosition(GPoint &p)
void GVertex::addEdge(GEdge *e) void GVertex::addEdge(GEdge *e)
{ {
if(std::find(l_edges.begin(), l_edges.end(), e) == l_edges.end())
l_edges.push_back(e); l_edges.push_back(e);
} }
void GVertex::delEdge(GEdge *e) void GVertex::delEdge(GEdge *e)
{ {
l_edges.erase(std::find(l_edges.begin(), l_edges.end(), e)); std::list<GEdge*>::iterator it = std::find(l_edges.begin(), l_edges.end(), e);
if(it != l_edges.end()) l_edges.erase(it);
} }
SPoint2 GVertex::reparamOnFace(const GFace *gf, int) const SPoint2 GVertex::reparamOnFace(const GFace *gf, int) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment