CDC::Pie help needed
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: CDC::Pie help needed

Threaded View

  1. #1
    Join Date
    Jun 2013
    Posts
    16

    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 10: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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center