Circle: Tangent | Tangent | Through Point

Does anyone have a c# or python component that will give me the resulting Circle in red, with only the blue inputs.

Basically i have a Arc and Line and P1.
I need the red Circle or point C or the Radius. The circle center has to be on axis2, and the circle has to be tangent to the Line and the Arc.

My Solution:

  1. Get Distance from P1 to closest point on Arc which is Length A
  2. Get C on Axis2 using Length A
  3. Get Distance from point C to Closest point on Arc which is Length B
  4. Compare Length A and Length B
  5. If they are not Equal adjust Length A until equal with Length B (12.3 KB)