[Math] Bounding box enclosing circles, that complies with ratio constraints

circleseuclidean-geometry

Given a circle centered at $A$, with radius $R_a$ and another radius $R_b$, I need to find a center for circle $B$ such that both circles are tangential, and the bounding box including both circles complies with ${height\over width}=k$

Best Answer

By scaling one can assume that $R_a=1$, and we can put $R_b=r$. This answer only looks at the case where the second circle of radius $r$ is positioned so that its point of tangency with the unit circle (center at $A=(0,0)$ lies in the first quadrant. We also assume that the $r$ circle protudes enough in the $x$ direction so that the bbox needs to extend to the right of $x=1$, and that the $r$ circle is far enough down from the top that the entire $r$ circle lies below the line $y=1$.

The center of the $r$ circle lies at $((1+r) \cos \theta, (1+r) \sin \theta)$ where $\theta$ is the angle formed by the center of the $r$ circle, the origin, and the positive $x$ axis. Then the condition that the $r$ circle lies below $y=1$ is $$[1]\ \ \ r+(1+r)\sin \theta \le 1.$$ And the condition that the $r$ circle protrudes beyond the line $x=1$ is $$[2]\ \ \ r+(1+r)\cos \theta \ge 1.$$ The ratio $k$ under these assumptions comes from the fact that, in this situation, the height of the bbox is $2$ while its width, extending from $x=-1$ to the rightmost point of the $r$ circle, is $1+(1+r)\cos \theta +r$. This gives the ratio as $$k = \frac{2}{(1+r)(1+\cos \theta)},$$ which solves for $\cos \theta$ as $$\cos \theta=\frac{2}{k(1+r)}-1.$$ One can then find $\theta$ via arccos. Even in this simple case, it is necessary to know that [1] and [2] are satisfied, in order for the expression for $\cos \theta$ to achieve $k$ be valid. I've attempted to eliminate $\cos \theta$ and $\sin \theta$ from conditions [1] and [2], but it gets involved.

Note that here the value of $k$ must lie in the interval $[1/(1+r),1]$ in order for there to be a possible $r$ circle, where the smallest $k$ corresponds to the case where the $r$ circle is tangent to the unit circle at $(1,0)$. One naturally also needs $r<1$ or else the $r$ circle will extend beyond $y=1$ and change the formula for $k$.

It remains to look at other cases, for example the case wherein the $r$ circle extends both to the right of $x=1$ and above $y=1$. And the conditions [1] and [2] need to be restated without $\theta$, for a complete answer. There may be another way to look at this question, which would not involve so many cases and conditions.

Related Question