المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : rectangle rotation



C++ Programming
03-31-2009, 03:43 AM
Hello,
please help me to write a function rotate that will rotate the rectangle 45 degrees each time button is pressed

let say that rectangle values are as follows
rectangle[0].x=250.0;
rectangle[0].y=100.0;
rectangle[1].x=550.0;
rectangle[1].y=100.0;
rectangle[2].x=550.0;
rectangle[2].y=300.0;
rectangle[3].x=250.0;
rectangle[3].y=300.0;

i know that it should be something like
H2 = H·cos? + W·sin?
W2 = H·sin? + W·cos?
where H2 is the height of the rotated rectangles and W2 is the width.

i need an assistance in writing this function.. please help