9
$\begingroup$

Imagine a rectangle (x1 by y1) always has to be drawn with horizontal and vertical lines (so it can't have lines at 45 degrees). If the rectangle is rotated by angle θ, it needs to have a rectangle drawn inside it so that this new rectangle still follows the rules. In the diagram, the black rectangle is the original, the red one is the rotated rectangle, and the green ones are three possible options (the two extremes, and one which maintains the aspect ratio).

Rotated rectangles diagram

How can I work out (in terms of x1, y1 and θ):

  1. the dimensions (x2 and y2) of the rectangle which maintains the aspect ratio of the original?
  2. the dimensions (x2 and y2) of the rectangle which has the largest possible area within the given boundaries?
  3. x2 for a given y2 (and vice-versa) within a valid range?

Answers to only one part are quite welcome. I've tried to work this out myself by looking at what I know about the resulting triangles, and can't seem to get anywhere (it's been a while since I studied Maths), so an answer to one of these might point me in the right direction.

$\endgroup$
2
  • 1
    $\begingroup$ Is it necessary that the center of the new rectangles always be the same as the center of the original rectangle? $\endgroup$ Commented Feb 8, 2011 at 17:46
  • $\begingroup$ Yes, but I don't really see how it makes much difference mathematically, given that the middle green rectangle (or any rectangle that aren't the two extremes shown) can freely slide one way or the other without changing size. $\endgroup$
    – Nathan
    Commented Feb 9, 2011 at 9:31

2 Answers 2

4
$\begingroup$

Let's say that the origin of a coordinate system is at the center of the original black rectangle. This is the center of the rotation and also the center of each of the green rectangles. Consider only the first quadrant (from the origin up and to the right). Exactly 1/4 of the black rectangle and each green rectangle is in the first quadrant. Let's further assume that, as in your picture, the angle of rotation is relatively small (say, less than 45°) and in the clockwise direction, and that $y_1<x_1$.

Let the vertex of the black rectangle that is in the first quadrant be $(a,b)=(\frac{1}{2}x_1,\frac{1}{2}y_1)$. Call the magnitude of the angle of rotation $\alpha$ ($0°<\alpha<45°$). The coordinates of the vertex of the red rectangle in the first quadrant are $(a\cos\alpha+b\sin\alpha,-a\sin\alpha+b\cos\alpha)$. The slope of the upper side of the red rectangle is $-\tan\alpha$. An equation for the upper side of the red rectangle in the first quadrant is $y-(-a\sin\alpha+b\cos\alpha)=-\tan\alpha(x-(a\cos\alpha+b\sin\alpha))$ for $0\le x\le a\cos\alpha+b\sin\alpha$. An equivalent simplified equation is $y=\sec\alpha(b-x\sin\alpha)$. This red upper side intersects the original black upper side at $x=b\cot\alpha(\sec\alpha-1)$.

So:

  • for $b\cot\alpha(\sec\alpha-1)\le x\le a$, the vertex of the green rectangle in the first quadrant will be on the red side, at $(x,\sec\alpha(b-x\sin\alpha))$, and it will have area $4x\sec\alpha(b-x\sin\alpha)$.
  • for $0\le x<b\cot\alpha(\sec\alpha-1)$, the vertex of the green rectangle in the first quadrant will be on the black side (here, I'm assuming from your picture that the green rectangle must be contained entirely within the black rectangle), at $(x,b)$, and it will have area $4xb$.
  • assuming that the green rectangle must be contained entirely within the black rectangle, $x$ cannot be greater than $a$.

Assuming the first case:

  • the maximum area is $b^2\csc\alpha\sec\alpha$ when $x=\frac{1}{2}b\csc\alpha$.
  • the green rectangle will have the same aspect ratio as the black rectangle when $x=\frac{ab}{b\cos\alpha+a\sin\alpha}$ (and the area is $\frac{4ab^3}{(b\cos\alpha+a\sin\alpha)^2}$).

edit: I originally forgot the factors of 4 on the area, moving from my picture of just one-fourth of things back to the whole rectangles. Similarly, note that my $x$- and $y$-values are half of your $x_2$ and $y_2$, respectively. The maximum possible area for the second case (where the vertex is at $(x,b)$) is $4b^2\cot\alpha(\sec\alpha-1)$, which Mathematica seems to be telling me cannot be greater than the maximum area for the first case under my assumptions about the problem.

$\endgroup$
2
  • $\begingroup$ Wow, thanks. That's amazing. You're assumptions were correct... I intended to get those across in the question, but obviously I didn't make it very clear. $\endgroup$
    – Nathan
    Commented Feb 9, 2011 at 9:21
  • $\begingroup$ @Nathan: Glad I could help. Most of the assumptions were easy to guess from your diagram, just not explicit in the text—most math contexts allow for few, if any, assumptions from diagrams. $\endgroup$
    – Isaac
    Commented Feb 9, 2011 at 18:51
0
$\begingroup$

The answer by Isaac,

the maximum area is b^2*cscα*secα when x=0.5*b*cscα = 0.5*b/sinα

seems to work for angles near 45 degrees. However, its range of validity seems to be aspect ratio dependent. For w/h aspect ratio >> a/b, it works for a large range of angles, but for aspect ratio = 1 it only works at 45 degrees.

It appears that within the valid range of this solution, only 2 diagonal vertices of the inner rectangle touch the sides of the rotated rectangle. But in the invalid range, all four vertices of the inner rectangle touch an appropriate side of the rotated rectangle.

This is easily seen by using α nearly zero (very little rotation), then sinα becomes nearly zero and x becomes very large, certainly much larger than a. Whereas the correct solution will be nearly the same size as the slightly rotated rectangle

I have tried solving this with lagrange multiplers and get the same answer. But I don't know how to put in an inequality constraint that x<=a.

I am wondering if this can be solved closed form with a more general solution that gives a solution for any angle and any aspect ratio. Or at least another solution that works where this solution fails. So far I have been unsuccessful.

I would appreciate hearing from the Mathematics experts on this.

$\endgroup$
1
  • 1
    $\begingroup$ When copying math, you can right-click on it and use "Show Source" to copy the $\TeX$ source; if you just copy the text it doesn't get typeset. $\endgroup$
    – joriki
    Commented Jun 21, 2011 at 9:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .