|
-
Sep 30th, 2012, 02:31 PM
#2
Re: calculate largest rectangle that fits in ellipse
The ellipse in your case is given by the equation
x^2 / A^2 + y^2 / B^2 = 1
where 2A is the width and 2B is the height of the ellipse. You wish to find a point (p, q) on the ellipse such that the area pq is maximized. Solve the above equation for y to get an expression valid for y >= 0:
y^2 / B^2 = 1 - x^2 / A^2
y = B sqrt(1 - x^2 / A^2)
The area pq is then just p*B sqrt(1 - p^2 / A^2). This is maximized when the derivative is zero, so differentiate with respect to p:
(pq)' = B sqrt(1 - p^2 / A^2) + B p*1/2*(1 - p^2 / A^2)^(-1/2) * (-2p/A^2) = 0
=> (1 - p^2 / A^2) - p^2 / A^2 = 0
=> 1 = 2p^2 / A^2 and p^2 / A^2 = 1/2
=> p = A sqrt(2)/2
=> q = B sqrt(1 - 1/2) = B sqrt(2)/2
The four corners are then just (+/- p, +/- q). The maximal area is 4pq = 2AB. The general case of a rotated, translated ellipse can be reduced to this case: take the center of the ellipse C, the axis X with constant A, the axis Y with constant B, and just move A*sqrt(2)/2 along the X axis or B*sqrt(2)/2 along the Y axis to get to your points. Computing these axes is another problem and depends on the form in which the ellipse is given. For the quadratic form, it's just completing the square.
Alternative derivation:
Consider a circle of radius 1. The area is maximized when p=q from symmetry and intuition. This occurs for points (p, q) = (sqrt(2)/2, sqrt(2)/2). Imagine scaling the vertical axis by B. Two rectangles pre-scaling have their area increased by a factor of B by the scaling, so the maximal-area rectangle is the same before and after scaling. Do the same with the horizontal axis, multiplying by A. The resulting points (p, q) are just (A sqrt(2)/2, B sqrt(2)/2), as I derived more rigorously from calculus above.
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|