I am trying to compute a circle which is tangent to two curves. For this, I have thought of using the class Geom2dGcc_Circ2d2TanRad and try the Geom2dGcc_Circ2d2TanRadGeo one as well. However, both classes seem to be affected by a bug (which I have not observed in OCC 6.7.1). The bug seems to be caught is the application is run from Visual Studio (I am using VS2010).
The bug is the following: when exiting the function (and destroying the Geom2dGcc_Circ2d2TanRad objects) I get the error "File: ..\..\..\dbgdel.cpp"
With the help of Sergey Zaritchny, I understood it has something to do with memory management.
My example which shows the problem is the following:
void GetLocationFillets( void )
// Constructing parabola.
gp_Pnt origin3D(0.0,0.0, 0.0);
gp_Dir planeDir( 0.0,0.0,1.0);
gp_Dir2d Vx( 1.0,0.0 );
gp_Dir2d Vy(0.0, 1.0);
Handle(Geom_Plane) plane = new Geom_Plane( origin3D, planeDir);
Handle(Geom2d_Line) lineOne = new Geom2d_Line( origin, Vx );
Handle(Geom2d_Line) lineTwo = new Geom2d_Line( origin, Vy );
assert( lineOne && lineTwo );
Handle(Geom2d_Curve) trimOne = new Geom2d_TrimmedCurve( lineOne, 0.0, 200.0, Standard_True);
Handle(Geom2d_Curve) trimTwo = new Geom2d_TrimmedCurve( lineTwo, 0.0, 200.0, Standard_True);
BRepBuilderAPI_MakeEdge e1( trimOne, plane );BRepBuilderAPI_MakeEdge e2( trimTwo, plane );
BRepTools::Write( e1.Edge(), "e1.brep");
BRepTools::Write( e2.Edge(), "e2.brep");
// Create qualified adaptors according to the desired solution
Geom2dGcc_Circ2d2TanRadGeo circle( Qn1, Qn2, 10.0, Precision::Confusion() );
assert( circle.IsDone() );
My questions are the following:
- Is there a workaround for this bug?
- Is there an alternative way I could use to create a circle tangent to two curves in OCC without using the classes I have mentioned?
- Is there any plan regarding this bug fix? I would like to use OCC 6.9 for my application.
I sincerely thank you for your help,