How to calculate the angle of an arc expressed by a gp_Circ entity

bioan

CAD practitioner
Hi !
I try to construct an arc from a gp_Circ entity and I need to know the angle of the arc in radians.
How can I get it?

I appreciate your help with this issue!
Ioan
 

Quaoar

Administrator
Staff member
@bioan The gp_Circ entity contains its placement and radius, but not parametric ranges. You are supposed to construct the Geom_Circle out of it, and trim this curve, e.g., with Geom_TrimmedCurve or by constructing an edge. Do you know the extremity points of your arc? If so, you might be asking how to get the angle from the known 3D points, but otherwise, it is always 360 degrees for the gp_Circ entity.

Anyway, if you share some more context, it will be easier to answer.
 

bioan

CAD practitioner
Thank you very much for your response!
I try to tessellate an arc which is constructed starting from its base circle and the angle of the arc expressed in radians.
I managed the resolve the arc value, but now I have a problem of construction when the value is a negative one.
This is my code:

double firstParam = 0;
double lastParam = arcAngleInRadians;
double Step = (10* 2 * PI) / 360; // tessellate the arc with 10 degree step
double param = 0;​
gp_Pnt P1, P2;

P1 = ElCLib::Value(firstParam, myArc);
for (param = firstParam+Step; param < lastParam; param += Step)
{
_ArcTessalatePoints->AddVertex(P1.X(), P1.Y(), P1.Z());
P2 = ElCLib::Value(param, myArc);
_ArcTessalatePoints->AddVertex(P2.X(), P2.Y(), P2.Z());
P1 = P2;
}

This code is ok for a positive arc angle value, but when the value of the arc angle is negative the arc is constructed in the opposite side of it's center.

Any advice and suggestions are welcome and much appreciated!
 

Quaoar

Administrator
Staff member
@bioan Which value do you tune to reproduce the problem?

Btw, you may want to look into the GCPnt package for discretization algorithms of OpenCascade.
 

bioan

CAD practitioner
I think I found a solution to my problem, but anyway thank you very much for the hint!!!
For sure is a long way for me to use and to get used with OCC!
Happy w-end!
Ioan
 
Top