Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I suppose this question should migrate to a more math related site.</p> <p>Try to imagine where these two tangent circles go when the circles <strong>a</strong> and <strong>b</strong> get further and further apart. They get closer to the line <strong>AB</strong>. Once the <strong>AB</strong> segment equals <strong>4r</strong> these two tangent circles will overlap. From now on, once circles <strong>a</strong> and <strong>b</strong> get further apart, there's no tangent circles whatsoever.</p> <p>If you want to calculate the position of these circles, just assume that the distance between the centers is always <strong>2r</strong>:</p> <p><img src="https://latex.codecogs.com/gif.latex?%28x_C-x_A%29%5E2&plus;%28y_C-y_A%29%5E2%3D4r%5E2%5C%5C%20%28x_C-x_B%29%5E2&plus;%28y_C-y_B%29%5E2%3D4r%5E2" alt=""></p> <p>You should get two, one or none solutions for xC and yC, which will be the centers of your tangent circles. I hope I haven't messed something up.</p> <h2>Solutions</h2> <p>Provided you do know there are solutions ( just check if <code>d(A,B) &lt;= 4r</code> ), these are the coordinates of your two circles:</p> <p><a href="http://pastebin.com/LeW7Ws98" rel="nofollow noreferrer">http://pastebin.com/LeW7Ws98</a></p> <p>A little scary, eh? But it's working. There are the following variables:</p> <p><code>x_A, y_A</code> - the coordinates of the circle A,</p> <p><code>x_B, y_B</code> - the coordinates of the circle B, </p> <p><code>r</code> - the radius. </p> <p>I've checked the solutions with the values from one of my comments below. I think that you can copy these solutions and inject them into your code straight away (provided there's a sqrt function) and get the results after declaring some variables.</p> <p>These solutions are loosely derived from the Save's proposition but I couldn't comment below his answer - I've got less than 50 reputation points, duh ... ( thanks SO! You're the man! ). However I'm pretty sure they should be valid for my system anyways. Cheers</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload