Bounding box enclosing circles, that complies with ratio constraints 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$
 A: 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.
A: There are really only two cases you have to consider.
In one case, one circle touches two adjacent sides of the bounding box
and the other circle touches the other two sides,
hence a small variation in the placement of either circle will change both the
width and height of the bounding box.
In the other case, the smaller circle touches only one side of the bounding box
and the other three sides touch the larger circle, 
so that a small variation in the position of either circle 
changes only one dimension of the bounding box,
while the other dimension is determined by the larger radius alone.
If the two radii are equal then the first case covers all possibilities.
(I'm not considering the possibility that one circle is inside the other, since the
only possible value of $k$ in that event is $1$ and that value is easily obtained
by the first case listed above.)
For convenience, let $R = R_a + R_b$ and let $r = \max\{R_a, R_b\}.$
Assume Cartesian coordinates, and let 
$\Delta x$ be the difference of $x$-coordinates of the two circles' centers, 
$\Delta y$ the difference of their $y$-coordinates.
Since the circles are externally tangent to each other,
$$(\Delta x)^2 + (\Delta y)^2 = R^2.$$
Case 1
Now let's consider the first case, where each circle is touching at least two sides.
It should be clear that the width of the bounding box is $R + |\Delta x|$
regardless of which circle is placed to the left, right, above, or below the other,
and similarly the height of the bounding box is $R + |\Delta y|.$
I'll assume that the aspect ratio $k$ is meant to be the ratio of height to width, 
so we require
$$k = \frac{R + |\Delta y|}{R + |\Delta x|}.$$
Solving for $|\Delta y|$ in this equation, we find that
$$|\Delta y| = (k - 1)R + k \; |\Delta x|.$$
Plug this into the equation $(\Delta x)^2 + (\Delta y)^2 = R^2,$ and a little
algebra gives us
$$ (\Delta x)^2 + k(k-1)R \; |\Delta x| + \left(\frac{k^2}{2} - k\right)R^2 = 0. $$
Solve this as a quadratic equation in $|\Delta x|$
(discarding the negative root of the equation), and the relative placement
of the two circles is then fully determined up to translations and reflections
parallel to the axes.
Of course, this works only for certain values of $k.$
The fact that each circle must touch two sides imposes some constraints, namely,
$|\Delta x| \geq |R_a - R_b|$ and $|\Delta y| \geq |R_a - R_b|.$
Note that $|R_a - R_b| = 2r - R.$
The extreme values of $k$ are achieved at the largest possible values
of $|\Delta x|$ and $|\Delta y|,$ namely, when either
$|\Delta x| = 2r - R$ or $|\Delta y| = 2r - R.$
When $|\Delta x| = 2r - R,$ the width of the bounding box is $2r$ and the
height is $R + |\Delta y|.$
We know that
$$ (\Delta y)^2 = R^2 - (\Delta x)^2 = R^2 - (2r - R)^2 = 4r(R-r), $$
and we know that $r$ and $R - r$ are $R_a$ and $R_b$ (not necessarily in that order), so
$$ |\Delta y| = 2 \sqrt{R_a R_b}. $$
This gives us
$$ k_1 = \frac{R + 2\sqrt{R_a R_b}}{2r}$$
as one of the bounds of $k.$
The other bound occurs when $|\Delta y| = 2r - R,$ which gives a bound
$$ k_2 = \frac{2r}{R + 2\sqrt{R_a R_b}} = \frac{1}{k_1}. $$
(We could also conclude that $k_2 = \frac{1}{k_1}$ via a symmetry argument.)
Therefore the "first case" occurs when
$$ \frac{2r}{R + 2\sqrt{R_a R_b}} \leq k \leq \frac{R + 2\sqrt{R_a R_b}}{2r}. $$
Case 2a
The "second case" has two subcases.
Let's consider the subcase where $|\Delta x| < 2r - R$
and therefore $k > \frac{R + 2\sqrt{R_a R_b}}{2r}.$
In this case we have
$$k = \frac{R + |\Delta y|}{2r},$$
so $|\Delta y| = 2kr - R$ and $|\Delta x| = \sqrt{R^2 - (\Delta y)^2}.$
Case 2b
Similar reasoning for the subcase where $k < \frac{2r}{R + 2\sqrt{R_a R_b}}$
yields the solution $|\Delta x| = 2kr - R$ and $|\Delta y| = \sqrt{R^2 - (\Delta x)^2}.$
Unsolvable cases
Since the bounding box for the largest and smallest possible
values of $k$ has one dimension equal to $2\max\{R_a, R_b\}$ 
and the other equal to $2R_a + 2R_b,$ we find that $k$ must satisfy
$$\frac rR \leq k \leq \frac Rr.$$
For any given $R_a$ and $R_b$ it is not possible to construct a bounding
box with an aspect ratio outside this interval.
If we are allowed to vary the size of either of the circles, we can achieve
any aspect ratio in the interval $\frac 12 \leq k \leq 2.$
No values of $R_a$ and $R_b$ permit $k$ to be outside this interval.
It may be of interest to observe that 
$R + 2\sqrt{R_a R_b} = \left(\sqrt{R_a} + \sqrt{R_b}\right)^2.$
