BRepExtrema_DistShapeShape error

I wrote a subroutine to determine whether a given point lies on a surface:

BRepBuilderAPI_MakeVertex vertexbuilder(p); //p is a gp_Pnt
TopoDS_Vertex vertex = vertexbuilder.Vertex();
BRepExtrema_DistShapeShape extrema;
extrema.LoadS1(F); //F is a TopoDS_Face
extrema.LoadS2(vertex);
extrema.Perform();

if (extrema.IsDone())...

It works fine for the first face. I can run through a whole list of points without a problem. But when it tries to check the second face, extrema.Perform() crashes. The exception occurs in NCollection_Sequence.hxx in the function:

  static void delNode (NCollection_SeqNode * theNode,
                       Handle(NCollection_BaseAllocator)& theAl)
  {
    ((Node *) theNode)->~Node();
    theAl->Free(theNode);
  }

 

Any ideas??

Kirill Gavrilov's picture

Supposedly, there is some memory corruption issue (in your code around or maybe in BRepExtrema_DistShapeShape), which needs to be debugged...

ed.hoppe_142088's picture

I ran it again using a different STEP file as input and it seems to work fine now. Possibly the STEP file was corrupted. Thanks.