Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Draw ARC

Posted on 2004-03-29
4
Medium Priority
?
1,093 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 750 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

688 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