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?
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: .0° < θ < 180°
The diagram looks like this:Code:+ - - - - - - - - - * - - - - + - : θ * * : : * * : : * L * : : * * : W·cosθ * W * : :* * : : * * θ: :θ * * : : * *: : * W * - : * L * : : * * : : * * : L·sinθ : * * θ : + - - - - * - - - - - - - - - + - | W·sinθ | L·cosθ |
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