Find the coordinates of the centre of a circle which is tangent to a given circle

281 Views Asked by At

I am trying to program the situation as show in figure below.

I have two circles, with centres at $(x_1,y_1)$ and $(x_2,y_2)$. The line segment connecting $(x_1,y_1)$ and $(x_2,y_2)$ makes an angle $\theta_2$ with the horizontal. I need to find the point $(h,k)$, such that the circle with this centre is tangent to the circle with centre $(x_2,y_2)$, where the line segment connecting $(x_1,y_1)$ and $(h,k)$ makes an angle $\theta_1$ with the horizon. All the three circles are of the same radius $r$.

Knowns: $(x_1,y_1)$, $(x_2,y_2)$, $r$, $\theta_1$, $\theta_2$
Unknowns: $(h,k)$.

Problem description

1

There are 1 best solutions below

0
On

The circle with centre $(x_2,y_2)$ is described by $$(x-x_2)^2+(y-y_2)^2=r^2.$$ The circle with centre $(h,k)$ will be tangent to this circle, precisely if the point $(h,k)$ lies on $$(x-x_2)^2+(y-y_2)^2=(2r)^2.\tag{1}$$ Now, the point $(h,k)$ will lie on the line $$y=\tan(\theta_1)(x-x_1)+y_1.\tag{2}$$ Substite the expression $(2)$ into $(1)$ and you will find a quadratic equation in $x$. Solve this using your favorite method for solving quadratic equations and substitute your solutions back into $(2)$ to find the the coordinates $(h,k)$ for which the two circles are tangent.

As alway, you can find either two, one or no solutions for this equation. In the case where you find two solutions (call them $(h_1,k_1)$ and $(h_2,k_2)$), you must decide which one to pick. You should of course pick the solution that is closes to $(x_1,y_1)$.

N.B. Once you know $\theta_1$ and $\theta_2$, you can calculate directly wether or not the stones will hit, using the results of this answer. This might save you some time.