# Draw ARC

I need  to find Start angle and End angle for the ARC with known Radius(r),Center point(x0,y0),Start(x1,y1) and End(x2,y2) points of the ARC.

Thank you.
###### Who is Participating?

Commented:
Hi shean85,

with this function you can calc the angle between two points (in degrees):

double CalcAngle( CPoint& p1, CPoint& p2 )
{
if ( p1.x == p2.x )
{
if ( p1.y < p2.y )
return 90.0;
else
return 270.0;
}
else if ( p1.y == p2.y )
{
if ( p1.x < p2.x )
return 0.0;
else
return 180.0;
}

return atan2( p2.y - p1.y, p2.x - p1.x ) * 180.0 / 3.14159265358;
}

// if you need it in radians you can simply calc it from result with
r = d * PI / 180; // d = angle in degrees, r in radians

With this you can easily calc angles from center to start- and endpoint.

hope this helps,

ZOPPO
0

Commented:
Hi shean85,
Are you using ObjectArx? Cause if so, you can :

dStartAngle = (Start - Center).angleTo(AcGeVector2d::kXAxis);
dEndAngle = (End - Center).angleTo(AcGeVector2d::kXAxis);

where Start, Center, End are AcGePoint2d.
0

Commented:
hm ... just forgot to mention you'll have to include <math.h> if not yet included ...

ZOPPO
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.