# Thread: rectangle rotation

1. ## rectangle rotation

I have to rotate a rectangle with some angle. after rotation I have to calculate howmuch width and height rectangle going to occpy. How to calculate width and height after rotation?

2. Originally Posted by kumar
I have to rotate a rectangle with some angle. after rotation I have to calculate howmuch width and height rectangle going to occpy. How to calculate width and height after rotation?
Rotation is an isometry. The length of width and height remain the same. What is your problem?

3. Hello, kumar!

I have to rotate a rectangle with some angle.
After rotation I have to calculate how much width and height rectangle will occupy.
How to calculate width and height after rotation?

Let L be the length and W be the width of the rectangle.
Let θ be the angle of rotation: .< θ < 180°

The diagram looks like this:
Code:
    + - - - - - - - - - * - - - - + -
:            θ  *    *        :
:           *         *       :
:       *  L           *      :
:   *                   *     : W·cosθ
*                      W *    :
:*                        *   :
: *                        * θ:
:θ *                        * :
:   *                        *:
:    * W                      * -
:     *             L     *   :
:      *              *       :
:       *         *           : L·sinθ
:        *    *  θ            :
+ - - - - * - - - - - - - - - + -
| W·sinθ  |       L·cosθ      |

4. Originally Posted by kumar
I have to rotate a rectangle with some angle. after rotation I have to calculate howmuch width and height rectangle going to occpy. How to calculate width and height after rotation?
First draw a diagram, see attachment.

RonL

5. Originally Posted by CaptainBlack
First draw a diagram, see attachment.

RonL

Ya, I have to calculate w2 and h2 for different angles

6. Hello, kumar!

Didn't I give you the formulas?

. . L
2 .= .L·cosθ + W·sinθ

. .W
2 .= .L·sinθ + W·cosθ

7. ## Thanks

Originally Posted by Soroban
Hello, kumar!

Didn't I give you the formulas?

. . L2 .= .L·cosθ + W·sinθ

. .W2 .= .L·sinθ + W·cosθ
Thanks soroban, I am trying with that formulas.

8. My Rectangle height is 13.8
Rectangle Width is 40.6
rotation angle is 30 degree.
I am using the below formula

newHeight = ( (Height*cos(radians)) + (Width*sin(radians)) )
newWidth = ( (Height * sin(radians)) + (Width * cos(radians)) )

but I am not getting correct widht and height. Its giving some -ive values for height

its giving height as -8.3
widht as 28.3

9. Originally Posted by kumar
My Rectangle height is 13.8
Rectangle Width is 40.6
rotation angle is 30 degree.
I am using the below formula

newHeight = ( (Height*cos(radians)) + (Width*sin(radians)) )
newWidth = ( (Height * sin(radians)) + (Width * cos(radians)) )

but I am not getting correct widht and height. Its giving some -ive values for height

its giving height as -8.3
widht as 28.3
Using Soroban's formula (which I haven't checked for myself, but he's usually trustworthy ) I'm not getting your numbers. Make sure your calculator is in DEGREE mode if you are using an angle in degrees. And given a 30 degree angle I see no way that the height can sensibly be negative from that formula since all quantities are positive.

-Dan