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
Solved

Draw ARC

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
scoreUp challenge 14 64
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 341
changeXy challenge 13 88
How to convert MFC::CString to UTF8 wchar_t* 10 278
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…

856 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