I have a problem in finding the radius and the center of a circle with the following conditions
- Circle tangential to line $g_1$ and going through known point $P_1$
- Circle is tangential to $g_2$
The following things I need to find:
- radius of circle $(r)$
- center of circle $(x_m, y_m)$
- coordinates of $P_2 (x_2,y_2)$
So far I know that because of the horizontal line the middle point of the circle need to be $x_m = x_1$. I then tried to continue with the equation of a circle but I have still $2$ unknowns ($y_m$ and $r$) because I do not know how to use the constraint of $g_2$.
Does anybody have a hint how to solve this problem?
Edit #1:
I tried to understand the "Special cases of Apollonius' problem" with two lines and one point. Here is the current progress: But I do not know how to continue since becaues P1 is already a point on the circle/the tangent.
Best Answer
Let $P_1 = (x_1, y_1)$. You can first find the intersection of $g_1$ and $g_2$.
Let the equation of $g_2$ be
$$ A x + B y + C = 0 $$
Set $ y = y_1$ and solve for $x$, this will give you,
$$ x = - \dfrac{B y_1 + C}{A} $$
Note that $A$ cannot be zero, because $g_2$ is not horizontal. If it is horizontal, then the problem becomes trivial to solve.
So now the intersection point between $g_1$ and $g_2$ is
$P_3 = (x_3, y_3) = (- \dfrac{B y_1 + C}{A} , y_1 ) $
Find the signed distance between $P_1$ and $P_2$:
$ d = x_1 - x_3 $
Next, find the angle between $g_1$ and $g_2$. There are two possible angles. The unit normal to $g_1$ is $u_1 = \langle 0, 1 \rangle$, and the unit normal to $g_2$ is $ u_2 = \langle \dfrac{A}{\sqrt{A^2 + B^2}}, \dfrac{B}{\sqrt{A^2 + B^2}} \rangle $. To get the angle right, we have to use a combination of dot product and cross product of $u_1$ and $u2$.
$ \cos(\phi_1) = u_1 \cdot u_2 $
$ \sin(\phi_1) = \bigg[ u_1 \times u_2 \bigg]_z $
And $ \phi_1 = \text{Atan2}(\cos(\phi_1), \sin(\phi_1) ) $
Therefore, the two possible angles between $g_1$ and $g_2$ are
$ \phi_1 $ and $ \phi_2 = \pi - \cos^{-1} ( u_1 \cdot u_2 ) $
From this, it follows that the possible signed radii are
$ r_1 = d \tan \bigg( \dfrac{\phi_1}{2} \bigg) $
and
$r_2 = - d \tan \bigg( \dfrac{\phi_2}{2} \bigg) $
And the center will be at
$ C_i = P_1 + (0, r_i) $
As an example, suppose $g_1$ is the line $y = 10$, and $g_2$ is the line $ y = \sqrt{3} (x + 15) $
First find the intersection point between the two lines
$ 10 = \sqrt{3} (x + 15) $ implies $ x_3 = -15 + \dfrac{10}{\sqrt{3}} $
Suppose $P_1 = (10, 0) $ , then $ d = x_1 - x_3 = 25 - \dfrac{10}{\sqrt{3}} $
$ u_1 = \langle 0, 1 \rangle$, $ u_2 = \langle - \dfrac{\sqrt{3}}{2} , \dfrac{1}{2} \rangle $
From this
$ \cos(\phi_1) = \dfrac{1}{2} $
$ \sin(\phi_1) = \dfrac{\sqrt{3}}{2} $
Therefore, $ \phi_1 = \dfrac{\pi}{3} $
And $ \phi_2 = \pi - \phi_1 = \dfrac{2 \pi}{3} $
From this,
$r_1 = d \tan(\dfrac{\pi}{6} ) = (25 - \dfrac{10}{\sqrt{3}}) (\dfrac{1}{\sqrt{3}} ) = \dfrac{1}{3} ( 25 \sqrt{3} - 10 ) $
And
$r_2 = - d \tan(\dfrac{\pi}{3} ) = - (25 \sqrt{3} - 10 ) $
Here is additional figures obtained from this algorithm.