I have a class called ObjectBezierCurve, which has a member (along with some other data) called myTopoDS_Edge (of course of type TopoDS_Edge).
The constructor gets an AIS_Shape, and the TopoDS_Edge is created as follows:
myTopoDS_Edge = TopoDS::Edge(theAIS_Shape->Shape());
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:
Handle(Object) curObject = Handle(Object)::DownCast(myData->Value(i));
if(Object->GeometryType() == CurveObject)
Handle(ObjectEdge) curEdge = Handle(ObjectEdge)::DownCast(curObject);
TopoDS_Edge curTopoDS_Edge = curEdge->get_TopoDS_Edge();
Standard_Real startParam, endParam;
Handle(Geom_Curve) theGeom_Curve = BRep_Tool::Curve(curTopoDS_Edge,startParam,endParam);
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?