<p>First let us solve the radius of your circle. You can see that the centers of the circles form a triangle. There are 8 possible triangles, of which 4 are mirror solutions across the line that connects the centers of your original circles.  The other solutions are permutations of inside tangent and outside tangent connections. </p>

<p><a href="https://i.sstatic.net/6XSpu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6XSpu.png" alt="enter image description here"></a></p>

<p><strong>Image 1</strong>: All possible solutions</p>

<p>So knowing the quadrant is hardly enough for the choice of solution.</p>

<h1>Solving the triangles</h1>

<p><a href="https://i.sstatic.net/S8qfp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/S8qfp.png" alt="enter image description here"></a></p>

<p>So for eaxmple let the circle be on the inner outside of both circles (the sign changes for the other solutions). Now you need to solve the equation:</p>

<p>$$
 D^2=(x+r_1)^2+(x+r_2)^2-2(x+r_1)(x+r_2)\cos(\beta)
$$</p>

<p>Now this can be solved in a computer algebra system and gives 2 solutions with numerous corner constraints (do it yourself it's important for robust code and obviously you need 4 solutions to check.)</p>

<p>$$
x=\frac{1}{2} \left(\pm\sqrt{\frac{\cos (\beta) (r_1-r_2)^2-2 D^2+(r_1-r_2)^2}{\cos (\beta)-1}}-r_1-r_2\right)
$$</p>

<p>Once you have x solved you can solve the center. This can be done in many ways but I would proceed by solving angle $\alpha$ and some vector rotation, normalization and scalar multiplication. Same calculation can be used to find the intersection point and the tangent is just this vector rotated by 90 degrees.</p>

<p>You could also use an alternate formulation with 2 angles and a vector sum of $a+b-c=0$, with 2 unknowns and 2 equations.</p>

CC BY-SA 3.0
2016-07-04T13:57:32.307Z
Thank you. Looking at the solutions, I think knowing the quadrants where the circles touch is sufficient, if I also know the direction of curvature.
Rikki-Tikki-Tavi
CC BY-SA 3.0
2016-07-04T15:51:19.163Z
Could you please elaborate on what you would do with the given data and radius $x$ to obtain the tangential points and directions?
Rikki-Tikki-Tavi
CC BY-SA 3.0
2016-07-04T17:20:30.423Z
@Rikki-Tikki-Tavi, What part do you not know how to compute: The other angles of a triangle  (use [law of sines](https://en.wikipedia.org/wiki/Law_of_sines)) or [vector rotation](https://en.wikipedia.org/wiki/Rotation_matrix)? If you look at the image you'll see that 2 of the solutions are in same quadrant. I would Instead use whether or not its the inside or outside tangent, or then you need to check all of them. (by the way it feels like I'm teaching you your high school trig again as i have taught you [Law of Cosines](https://en.wikipedia.org/wiki/Law_of_cosines) already)
joojaa
CC BY-SA 3.0
2016-07-02T08:25:52.297Z
2016-07-02T17:46:29.030Z
2016-07-02T17:46:29.030Z
joojaa
<p>I have two circles, that I know are both tangential to a third (unknown) circle. I also know what quadrants of the circles the tangential points are in. It is as pictured below. I also know the arc angle that the third circle spans between the two tangential points (beta).</p>

<p>I would like to know the location of the two tangential points, as well as one of the tangential directions, so I can draw the unknown (red) circle.</p>

<p>I currently have a working solution for this involving a nonlinear equation solver. If at all possible I would like to have a solution that involves no non-linear equation solving, because I need to run very many of these problems and I need precise results.</p>

<p><a href="https://i.sstatic.net/anI6om.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/anI6om.png" alt="Arrangement of the circles"></a></p>

CC BY-SA 3.0
2016-07-02T11:53:18.863Z
@ritwiksinha Everything written in black is known.The central points, the radii, and the arc angle.
Rikki-Tikki-Tavi
<computational-geometry>
Closed form solution to a problem of tangent circles
Rikki-Tikki-Tavi
# Closed form solution to a problem of tangent circles

(Asked by: username_0 on 2016-07-01)

I have two circles, that I know are both tangential to a third (unknown) circle. I also know what quadrants of the circles the tangential points are in. It is as pictured below. I also know the arc angle that the third circle spans between the two tangential points (beta).

I would like to know the location of the two tangential points, as well as one of the tangential directions, so I can draw the unknown (red) circle.

I currently have a working solution for this involving a nonlinear equation solver. If at all possible I would like to have a solution that involves no non-linear equation solving, because I need to run very many of these problems and I need precise results.

[![Arrangement of the circles](https://i.sstatic.net/anI6om.png)](https://i.sstatic.net/anI6om.png)

**Tags:** computational-geometry

> **Comments:**
> **username_0**: @ritwiksinha Everything written in black is known.The central points, the radii, and the arc angle.  

---

## 1 answers

### Answer by username_1 on 2016-07-02. Score: 4 | Accepted answer

First let us solve the radius of your circle. You can see that the centers of the circles form a triangle. There are 8 possible triangles, of which 4 are mirror solutions across the line that connects the centers of your original circles. The other solutions are permutations of inside tangent and outside tangent connections.

[![enter image description here](https://i.sstatic.net/6XSpu.png)](https://i.sstatic.net/6XSpu.png)

**Image 1**: All possible solutions

So knowing the quadrant is hardly enough for the choice of solution.

# Solving the triangles

[![enter image description here](https://i.sstatic.net/S8qfp.png)](https://i.sstatic.net/S8qfp.png)

So for eaxmple let the circle be on the inner outside of both circles (the sign changes for the other solutions). Now you need to solve the equation:

$$
D^2=(x+r\_1)^2+(x+r\_2)^2-2(x+r\_1)(x+r\_2)\cos(\beta)
$$

Now this can be solved in a computer algebra system and gives 2 solutions with numerous corner constraints (do it yourself it's important for robust code and obviously you need 4 solutions to check.)

$$
x=\frac{1}{2} \left(\pm\sqrt{\frac{\cos (\beta) (r\_1-r\_2)^2-2 D^2+(r\_1-r\_2)^2}{\cos (\beta)-1}}-r\_1-r\_2\right)
$$

Once you have x solved you can solve the center. This can be done in many ways but I would proceed by solving angle $\alpha$ and some vector rotation, normalization and scalar multiplication. Same calculation can be used to find the intersection point and the tangent is just this vector rotated by 90 degrees.

You could also use an alternate formulation with 2 angles and a vector sum of $a+b-c=0$, with 2 unknowns and 2 equations.

> **Comments:**
> **username_0**: Thank you. Looking at the solutions, I think knowing the quadrants where the circles touch is sufficient, if I also know the direction of curvature.  
> **username_0**: Could you please elaborate on what you would do with the given data and radius $x$ to obtain the tangential points and directions?  
> **username_1**: @username_0, What part do you not know how to compute: The other angles of a triangle  (use [law of sines](https://en.wikipedia.org/wiki/Law_of_sines)) or [vector rotation](https://en.wikipedia.org/wiki/Rotation_matrix)? If you look at the image you'll see that 2 of the solutions are in same quadrant. I would Instead use whether or not its the inside or outside tangent, or then you need to check all of them. (by the way it feels like I'm teaching you your high school trig again as i have taught you [Law of Cosines](https://en.wikipedia.org/wiki/Law_of_cosines) already)  

---

