# Rectangle in rotated bounding rectangle

I'm looking to find the width and height of a rectangle without rotation within a rotated bounding rectangle. I have rotation in degrees and the width and height of the bounding rectangle. Basically I'm looking to find the largest ( largest area ) un-rotated rectangle that will fit inside a rotated rectangle of any given size.

-
Isn't the smallest rectangle inside a bigger one an empty rectangle? – Tunococ Jan 29 '13 at 1:51
Yeah I think that's what it's called. – Jordan Jan 29 '13 at 2:04
I think the question is meant to be to find the largest rectangle with sides parallel to the axes. If so, this is an incompletely specified question. Many rectangles with sides parallel to the axes will fit into a shape like ◇ but there is no obvious choice of "largest", since we could fit a tall, narrow rectangle, a short, wide rectangle, a squarish rectangle, and so on. – David Moews Jan 29 '13 at 2:05
@DavidMoews - It seems like there has to be an equation for finding the largest possible rect that would fit. Just found this, although its too complicated for me to understand quickly. stackoverflow.com/questions/5789239/… – Jordan Jan 29 '13 at 2:13
Please make two corrections: 1) Ask for the "largest" rectangle 2) Specify one: with largest area or with largest perimeter or ... – Maesumi Jan 29 '13 at 4:04

Once you have that, find the smallest and largest $x,y$ coordinates of the 4 points.
The smallest and largest $x,y$ pairs correspond to the bottom-left and top-right corners of your rectangle.