How to calculate the two tangent points to a circle with radius R from two lines given by three points I need to calculate the two tangent points of a circle with the radius $r$ and two lines given by three points $Q(x_0,y_0)$, $P(x_1,y_1)$ and $R(x_2,y_2)$.
Sketch would explain the problem more. I need to find the tangent points $A(x_a,y_a)$ and $B(x_b,y_b)$. Note that the center of the circle is not given. Please help.

 A: Let $O$ be the centre of the circle. Consider $\triangle OAP$. Find $\angle APO$ using the cosine rule and the fact that $\angle QPR=2\angle APO$. We know that $\angle OAP=90^\circ$ and $|OA|=r$. Solve.
A: An identity that might prove useful in this problem is
$$
\cot\left(\frac{\theta}{2}\right)=\frac{\sin(\theta)}{1-\cos(\theta)}=\frac{1+\cos(\theta)}{\sin(\theta)}\tag{1}
$$
In $\mathbb{R}^3$, one usually uses the cross product to compute the sine of the angle between two vectors.  However, one can use a two-dimensional analog of the cross product to do the same thing in $\mathbb{R}^2$.
$\hspace{5cm}$
In the diagram above, $(x,y)\perp(y,-x)$ and so the $\color{#FF0000}{\text{red angle}}$ is complementary to the $\color{#00A000}{\text{green angle}}$. Thus,
$$
\begin{align}
\sin(\color{#FF0000}{\text{red angle}})
&=\cos(\color{#00A000}{\text{green angle}})\\[6pt]
&=\frac{(u,v)\cdot(y,-x)}{|(u,v)||(y,-x)|}\\[6pt]
&=\frac{uy-vx}{|(u,v)||(x,y)|}\tag{2}
\end{align}
$$
$uy-vx$ is the normal component of $(u,v,0)\times(x,y,0)$; thus, it is a two dimensional analog of the cross product, and we will denote it as $(u,v)\times(x,y)=uy-vx$.
Let $u_a=\frac{Q-P}{|Q-P|}$ and $u_b=\frac{R-P}{|R-P|}$, then since
$$
|A-P|=|B-P|=r\cot\left(\frac{\theta}{2}\right)
$$
we get
$$
\begin{align}
A
&=P+ru_a\cot\left(\frac{\theta}{2}\right)\\
&=P+ru_a\frac{1+u_a\cdot u_b}{|u_a\times u_b|}
\end{align}
$$
and
$$
\begin{align}
B
&=P+ru_b\cot\left(\frac{\theta}{2}\right)\\
&=P+ru_b\frac{1+u_a\cdot u_b}{|u_a\times u_b|}
\end{align}
$$
where we take the absolute value of $u_a\times u_b$ so that the circle is in the direction of $u_a$ and $u_b$.
A: Since you need the coordinates of the two points I'll give a more analytic solution. Choose your coordinates so that $PR$ lies on the $x$-axis. Introduce two unknowns, for example $x_b$ and $x_a$. Write the equation of the line through $P$ and $Q$. Express the coordinates of $A$ and $B$ in terms of the unknowns. It is easy to write the equations of the lines through $A$ and $B$, perpendicular to $PQ$ and $PR$, respectively. Their intersection is $O$, the centre of the circle, which must satisfy the equation of the angle bisector of $\angle QPR$. The last condition you need is that distance $OB$ is $r$. Solve the system.
A: My inclination would be to write the equations of the two lines, then use the point-to-line distance formula (the distance between $Ax+By+C=0$ and $(x,y)$ is $\frac{|Ax+By+C|}{\sqrt{A^2+B^2}}$) to write a system of two equations (the distance from the desired point to each line is $r$) in two unknowns (the coordinates of the desired point).  The system will have four solutions because it's based on the whole lines, not just the rays you've got in your picture.
