Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
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
show 1 more comment

1 Answer 1

If you don't have the coordinates of the rotated corners, just rotate each point.

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.

share|improve this answer
Can you please explain in a little more detail? It would be helpful. –  Jordan Jan 29 '13 at 1:52
Do you have the coordinates of the corners of the rotated rectangle? –  Jacob Jan 29 '13 at 1:54
No I don't have those coordinates. –  Jordan Jan 29 '13 at 2:00
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.