I start with an axis aligned rectangle, $R$, that I rotate by the angle $\theta$ to get $R'$.
Afterwards I'd like to identify another axis aligned rectangle, $P$ with the following additional constraints:
- The center of $P$ should be at the center of $R'$ (and $R$)
- All points inside $P$ should also be inside $R'$
- $P$ should be as big as possible, area wise
What is the width and height of $P$, in terms of the width and height of $R$ and $\theta$?
I'm not sure if these criteria uniquely identify a rectangle. If they do not, please enlighten me :)
I've attempted applying my brain to the problem, but it appears I am enough out of practice that this is too hard. Hence this cry for help ;)
I've found a related question that seems to be the same question, but the answer is for another question: Rectangle in rotated bounding rectangle
I think I've also found the same question on stack overflow, but the answers are messy, and the ones I've managed to read and put into practice turn out to be wrong: https://stackoverflow.com/questions/5789239/calculate-largest-rectangle-in-a-rotated-rectangle