Archived issue #0024226
Crash on Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, s0, s1);
Description
OCC crashes when exploring the edges a simple surface. I send in the surface in attachment so you can reproduce the error.
Steps to reproduce
for (TopExp_Explorer aSurfExp(aShape, TopAbs_FACE); aSurfExp.More(); aSurfExp.Next())
{
TopoDS_Face aFace = TopoDS::Face(aSurfExp.Current());
for (TopExp_Explorer aWireExp(aFace, TopAbs_WIRE); aWireExp.More(); aWireExp.Next())
{
TopoDS_Wire aWire = TopoDS::Wire(aWireExp.Current());
cout << "Wire" << endl;
for (TopExp_Explorer anEdgeExp(aWireExp.Current(), TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
cout << "Edge" << endl;
double s0, s1;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, s0, s1);
GeomLProp_CLProps props(aCurve, (s0 + s1)*0.5, 2, Precision::Confusion());
double aCurvature = props.Curvature();
cout << "Curvature: " << aCurvature << endl;
}
}
}
{
TopoDS_Face aFace = TopoDS::Face(aSurfExp.Current());
for (TopExp_Explorer aWireExp(aFace, TopAbs_WIRE); aWireExp.More(); aWireExp.Next())
{
TopoDS_Wire aWire = TopoDS::Wire(aWireExp.Current());
cout << "Wire" << endl;
for (TopExp_Explorer anEdgeExp(aWireExp.Current(), TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
cout << "Edge" << endl;
double s0, s1;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, s0, s1);
GeomLProp_CLProps props(aCurve, (s0 + s1)*0.5, 2, Precision::Confusion());
double aCurvature = props.Curvature();
cout << "Curvature: " << aCurvature << endl;
}
}
}
Public activity
2 archived notes
Participants are labeled by their role within this record.
That face has degenerated edge (an edge without 3d curve, representing a single point in 3d, required to close face boundary in parametric space of the surface with singularity). Use BRep_Tool::Degenerated() to check this situation.
Verifying that aCurve is null solves the problem (aCurve.IsNull()).