I'm trying to calculate the new width and height of an inner rotated rectangle. The bounding box dimensions are known also the initial values (w & h for rotaton 0deg) and so the current rotation angle (in this case 45 degrees).
Now, the user should be able to resize the bounding box. Therefore I need to recalculate its new height and width so I can save them properly.
I've tried several solutions including those two
How do I scale one rectangle to the maximum size possible within another rectangle?
and
Calculate rotated rectangle size from known bounding box coordinates
The last one represents my current state and I get weird small or sometimes negative results. (radians and degrees tested). I guess my whole approach is wrong so I don't really need complete solution. But, any hints or different solution approaches are highly appreciated.