To access myTopoDS_Edge, there is a function called get_TopoDS_Edge, which is by the way inherited from the superclass ObjectEdge. Then, this ObjectBezierCurve class is stored in a TColStd_HSequenceOfTransient sequence. In a completely different part of the program, I want to reconstruct the Bézier curve using myTopoDS_Edge of the class. This part looks like the following:
The problem is now if I cast theGeom_Curve into a Geom_BezierCurve, the curve loses all its poles, and only the first two of them remain. The weird thing is that if I create a Geom_Curve from myTopoDS_Edge in the constructor of ObjectBezierCurve, and cast it to Geom_BezierCurve, it gives back the proper Bezier curve. However, in this other part of the program I do completely the same thing, and gives back a very different one. Is this a known bug or I am missing something?
If someone is interested, I have found the answer to the question.
It turned out that the TopoDS_Shape returned by
contains a Handle to a memory space which is constantly modified in another part of the program. It turned out that the Geom_BezierCurve in this memory space is a Bezier Curve with 2 poles by default.
So in summary, I can say that if you crate an AIS_Shape based on a TopoDS_Shape be careful what Geom_***** entity you use. Make sure you do not modify this memory address somewhere else. If you do, and want your new shape to be a separate one, use the Copy() function that creates a completely new Geom_ entitiy in a different address.