Solved

Draw ARC

Posted on 2004-03-29
4
1,084 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 31

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 31

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 75
sumHeights2  challenge 7 103
noX challenge 17 116
Path of Workbook 3 77
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 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