sooraj subramanya
sooraj subramanya

Reputation: 75

Unable to rearrange the Co-ordinates of an Ellipse after rotation

I have drawn an Ellipse. I have 8 handles to it.

The handles are TopLeft, MidTop,TopRight, MidLeft, MidRight, BottomLeft, MidBottom, BottomRight.

Whenever a user hovers on any of these handles cursor gets displayed. For displaying the cursor I have referred MS-WORD shape ellipse.

My problem arrives when I roatate or I make a mirror image of an ellipse. I am not able to rearrange the Co-ordinates, hence the cursors are not displayed properly.

Please Help.

Note: Please open MS-WoRD. Goto "INSERT" Select "SHAPPES" In that select "Ellipse" shape. Draw it. If you click on it you will see 8 points surrounding ellipse shape. Those are called handles. If you hover your mouse on any of the handle check the cursor display. Cursor display is depending the handle. I need to implement the same functionality as it is in MS-WORD in VC++. .

EDIT - Added information below from comments:

The problem is with rearranging the coordinates after I rotate. If I roatate the ellipse slightly towards the right (try in MS-WoRD). Which point do i consider as Top-Left? I tried to rearrange with the above code. But it didnt work for many cases. Getting the top-left point after I rotate the ellipse is the main big problem i am facing right now.

struct SortingFunction 
{ 
    bool operator()(const CRect& a, const CRect& b) 
    { 
        if (a.left == b.left) 
            return a.top <= b.top; else return a.left < b.left; 
    } 
}

Upvotes: 2

Views: 183

Answers (1)

Orochi
Orochi

Reputation: 397

Handles are also points, all you need to do is to identify the amount of rotation ellipse has gone to and rotate the handles with that rotation.

Upvotes: 0

Related Questions