9
$\begingroup$

I have the following problem:

Given a Rectangle with $L$ length and $W$ width and $2$ circles with $r_1$ and $r_2$ radius, determine if it's possible to fit these two circles inside the rectangle.

I realized that:

If $2r_1 > L$ or $2r_1 > W$ or $2r_2 > L$ or $2r_2 > W,$ then it is not possible to fit the circles in the rectangle. Thus if $2 r_1 + 2r_2 \leq L$ and $2r_1 + 2r_2 \leq W,$ they can fit vertically or horizontally.

My doubt is to check if they can fit diagonally? How do I get it ?

  • 0
    We can sometimes do better diagonally. For example, we can fit two circles with radius $1$ diagonally in a square of side $2+\sqrt{2}\approx 3.414$.2012-07-18

2 Answers 2

6

Here is my thought process here:

It's true that the best way to proceed will always be to stick one circle 'in one corner' of the rectangle and to try to fit the other circle 'in the opposite corner.' I take this for granted. It is very easy to understand where the center of a circle will go when the circle is 'tucked in a corner,' as both sides of the rectangle will be tangent to the circles. For example, if the rectangle is at coordinates $(0,0), (0,h), (l,0),$ and $(l,h)$, and a circle of radius $r_1$ is in the bottom-left corner, then the coordinates of its center will be $(r_1, r_1)$. If another circle, this one of radius $r_2$, is tucked in the top-right corner, the coordinates of it's center will be at $(l-r_2, h-r_2)$.

So one has to check two things: one has to make sure that both circles fit in the rectangle itself (without worrying about overlap), and then one has to make sure that the distance between the centers is greater than the sum of the radii.

So $2r_1, 2r_2 \leq l,h$ and $d[(r_1,r_1), (l-r_2,h-r_2)] \geq r_1 + r_2$ should be necessary and sufficient, where I let $d(\cdot, \cdot)$ denote the distance function.

  • 0
    Or $(l+h-r)^2 \geq 2lh$2012-07-18
1

Can you see that your best configuration is with the two circles in opposite corners, and that the limit is with the circles tangent to one another? Draw that tangent configuration and see if you can find a use for Pythagoras ... then work out which way the inequality goes. You might want to set $R=r_1+r_2$, which looks as though it could simplify the algebra.