Solved

Draw ARC

Posted on 2004-03-29
4
1,079 Views
Last Modified: 2013-11-20
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.


Please help me.

Thank you.
0
Comment
Question by:shean85
  • 2
4 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 10711679
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.
Radius information is useless/redundant.
0
 
LVL 30

Accepted Solution

by:
Zoppo earned 250 total points
ID: 10712142
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
 
LVL 30

Expert Comment

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

ZOPPO
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now