Geting angle values from Arc


How can I get angle values from TopoDS_Edge created from geom_curve??

my code is:

gp_Ax2 ax2 = new gp_Ax2(center,direction);
gp_Circ circle = new gp_Circ(ax2,radius);

GC_MakeArcOfCircle arcMaker = new GC_MakeArcOfCircle(circle, angle1,angle2, true);

if (arcMaker.IsDone())
Geom_TrimmedCurve arc = arcMaker.Value();
BRepBuilderAPI_MakeEdge edgeMaker = new BRepBuilderAPI_MakeEdge(arc);
return edgeMaker.Edge();

I looking for way to extract back angle1 and angle2 values from TopoDS_Edge. How can I do it?

Pawel's picture

Hi Marek,

one of the possibilities could be to extract the circle back from the edge and calculate the angles based on the obtained parameters value:

Standard_Real first = 0, last = 0;
Handle_Geom_Curve theCurve = BRep_Tool::Curve(TopoDS::Edge(edge,first,last);

if(theCurve.IsNull() == Standard_False)
Handle(Geom_Circle) circle = Handle(Geom_Circle)::DownCast(theCurve);

if(circle.IsNull() == Standard_False)
// if the edge is a circle-based one the angles are the parameter values: first and last


marek99's picture

Many thanks for help. It works the same for circle and ellipses.