-
October 11th, 2013, 07:24 AM
#1
CDC::Pie help needed
Hello,
I am suing CDC::Pie to draw a pie shape on the screen. The function is this:
BOOL Pie(LPCRECT lpRect, POINT ptStart, POINT ptEnd);
Say I just know the angle I need for the pie, how can I calculate the start and end points from the angle and a given angle sweep?
I tried this:
float angle1 = 0;
float angle2 = 90; // sweep angle
int radius = rectClient.CenterPoint().x;
int x1 = rectClient.CenterPoint().x + radius * cos(Degrees2Radians(angle1));
int y1 = rectClient.CenterPoint().y + radius * sin(Degrees2Radians(angle1));
int x2 = rectClient.CenterPoint().x + radius * cos(Degrees2Radians(angle1+angle2));
int y2 = rectClient.CenterPoint().y + radius * sin(Degrees2Radians(angle1+angle2));
and it seems to work, but the coordinate system seems to be:
Code:
-90
|
|
+-180---------------- 0
|
|
90
How can I get it into this coordinate system:
Code:
0
|
|
270---------------- 90
|
|
180
Thanks!
Last edited by clow; October 11th, 2013 at 09:18 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|