Calculate center of circle tangent to two lines in space

What you want is the tangent, tangent, radius algorithm. One way to handle this is as follows:

  1. Measure the angle $\alpha = \widehat{RQP}$. This is done using the cross product and dot product from the coordinates of the points.
  2. Construct the bisector of the angle and note that if the radius is known as $h$ the distance from the vertex to the circle center $QA$ is $$s=\frac{h}{\sin \frac{\alpha}{2}}$$
  3. Numerically create a vector of length $s$ along $QR$ and rotate it by $\frac{\alpha}{2}$ to find point $A$.

TTR