How to construct a circle that is tangent to three given semi- circles?

Supposing that: A(0,0), B(b,0), C(0,c)

So AB is horizontal and AC is vertical we can calculate it. @jfbu did these calculations and I just implemented them into a PSTricks picture.

\documentclass[pstricks,dvipsnames]{standalone}
\usepackage{pst-eucl}

\pagestyle{empty}

\begin{document}

\begin{pspicture}(-3,-3.5)(4.5,5.5)
\pstVerb{%
%% Enter the coordinates of the points of the rectangled triangle
%% A(0,0), B(3,0), C(0,4) 
%% So AB is horizontal
%% AC is vertical
/xA 0 def
/yA 0 def
/xB 3 def
/yB 0 def
/xC 0 def
/yC 4 def
%% Midpoints of the sides
/mAx xB xC add 2 div def
/mAy yB yC add 2 div def
/mBx xA xC add 2 div def
/mBy yA yC add 2 div def
/mCx xA xB add 2 div def
/mCy yA yB add 2 div def
%% Calculating the radius of the half circles along the sides of the
%% rectangled triangle
/rAB xA xB sub 2 exp yA yB sub 2 exp add sqrt 2 div def
/AB rAB 2 mul def
/rAC xA xC sub 2 exp yA yC sub 2 exp add sqrt 2 div def
/AC rAC 2 mul def
/rBC xB xC sub 2 exp yB yC sub 2 exp add sqrt 2 div def
/BC rBC 2 mul def
/DENOM BC 5 mul AB 3 mul add AC 3 mul add def
%% @JFBU formula
%% X = 2 AB (AB + BC) / (5 BC + 3 AB + 3 AC)
%% Y = 2 AC (AC + BC) / (5 BC + 3 AB + 3 AC)
%% R = 2 (BC + AB) (BC + AC) /  (5 BC + 3 AB + 3 AC)
/x0 AB BC add AB mul 2 mul DENOM div def
/y0 AC BC add AC mul 2 mul DENOM div def
/r0 BC AB add BC AC add mul 2 mul DENOM div def
%% @JFBU formula for the tangent points
%% P1 = (2(a+c)c, -(a+b+c)c) / (3a + b + 2c)
%% P2 = (-(a+b+c)b, 2(a+b)b) / (3a + 2b + c)
%% P3 = ((a+b+c)(a+c), (a+b+c)(a+b))/ (3a + 2b + 2c)
/p1x BC AB add AB mul 2 mul BC 3 mul AC add AB 2 mul add div def
/p1y BC AC add AB add AB mul BC 3 mul AC add AB 2 mul add div neg def
/p2x BC AC add AB add AC mul BC 3 mul AC 2 mul add AB add div neg def
/p2y BC AC add AC mul 2 mul BC 3 mul AC 2 mul add AB add div def
/p3x BC AC add AB add BC AB add mul BC 3 mul AC 2 mul add AB 2 mul add div def
/p3y BC AC add AB add BC AC add mul BC 3 mul AC 2 mul add AB 2 mul add div def
}
%% Setting the nodes of the points of the triangle
\pstGeonode[PointSymbol=none,PosAngle={225,-45,90}](!xA yA){A}(!xB yB){B}(!xC yC){C}
\pspolygon[linecolor=blue,linejoin=1](A)(B)(C)
%% Setting the nodes of the midpoints of the triangle sides
\pstMiddleAB[PointSymbol=none,PointName=none]{A}{B}{MAB}
\pstMiddleAB[PointSymbol=none,PointName=none]{A}{C}{MAC}
\pstMiddleAB[PointSymbol=none,PointName=none]{B}{C}{MBC}
%% Full circles along the sides of the triangle (not needed!)
%\pscircle(MAB){!rAB}
%\pscircle(MAC){!rAC}
%\pscircle(MBC){!rBC}
%% Drawing the half circles along the sides of the triangle
\pstArcOAB[linecolor=lightgray]{MAB}{A}{B}
\pstArcOAB[linecolor=lightgray]{MAC}{C}{A}
\pstArcOAB[linecolor=lightgray]{MBC}{B}{C}
%% circle and tangent points
\pnode(!x0 y0){O}
\pnode(!p1x p1y){P1}
\pnode(!p2x p2y){P2}
\pnode(!p3x p3y){P3}
\pscircle[linecolor=Green](O){!r0}
\psdot[linecolor=red](P1)\uput[-90](P1){$P_1$}
\psdot[linecolor=red](P2)\uput[180](P2){$P_2$}
\psdot[linecolor=red](P3)\uput[90](P3){$P_3$}
\pspolygon[linejoin=1,linecolor=red,linewidth=0.5pt](P1)(P2)(P3)
\end{pspicture}
\end{document}

enter image description here

Hope this answers the question.

As an animated gif:

enter image description here


For a triangle with a right angle:

\documentclass[border=15pt,pstricks,12pt]{standalone}
\usepackage{pst-eucl}
\def\pstInvCircle#1#2#3#4{%
  \pnode(!
    \psGetNodeCenter{#1}
    \psGetNodeCenter{#2}\psGetNodeCenter{#3} 
    #2.x #1.x sub #2.y #1.y sub Pyth /l12 ED
    #2.x #1.x sub #2.y #1.y sub #3.x #1.x sub #3.y #1.y sub Pyth2 /l23 ED
    #3.x #1.x sub #3.y #1.y sub Pyth /l31 ED 
    l23 5 mul l12 3 mul add l31 3 mul add /Denom ED
    l12 l23 add l12 mul 2 mul Denom div /xM ED
    l31 l23 add l31 mul 2 mul Denom div /yM ED
    l23 l12 add l23 l31 add mul 2 mul Denom div /rM ED
    xM yM ){#4}%
  \pscircle[linecolor=red,linewidth=2pt,dimen=inner](#4){! rM }%
}
\begin{document}
\psset{unit=2}
\begin{pspicture}[showgrid](-2,-2)(4,5)
\psset{PointSymbol=none,PointName=none,dimen=inner,opacity=0.5}
\pstTriangle[linecolor=blue,linewidth=2pt,linejoin=2](0,0){A}(3,0){B}(0,4){C} 
\pstMiddleAB{A}{B}{I1} \pstArcOAB[fillstyle=solid,fillcolor=red!40]{I1}{A}{B}
\pstMiddleAB{B}{C}{I2} \pstArcOAB[fillstyle=solid,fillcolor=blue!40]{I2}{B}{C}
\pstMiddleAB{C}{A}{I3} \pstArcOAB[fillstyle=solid,fillcolor=green!40]{I3}{C}{A}
\psset{linecolor=red,linewidth=2pt,dimen=inner}
\pstInvCircle{A}{B}{C}{O}
\psdot(O)
\end{pspicture}
\end{document}

enter image description here


One possible way/starting point (but not accurate here) is to use something like this:

%&pdflatex
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
\documentclass[a4paper, pdf, x11names]{standalone}
\usepackage{pstricks}
\usepackage{pstricks-add, auto-pst-pdf}

\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
\pstTriangle[PointSymbol=none, PointName={A,B,A}](4,1){A}(1,3){B}(5,5){C}
\pstCircleABC[CodeFig=true, CodeFigColor=white,linecolor=red, PointSymbol=none, PointName={}]{A}{B}{C}{O}
\end{pspicture}
\end{document}

to get:

enter image description here

Here you basically define (atleast) three-points in space and let the circle pass through them.

Update 1:

To get the desired results, define some pseudo points (as in the so-called Bezier's trick and 3 tangential points on the circle as in

%&pdflatex
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
\documentclass[a4paper, pdf, x11names]{standalone}
\usepackage{pstricks}
\usepackage{pstricks-add, auto-pst-pdf}
%\usepackage{pst-solides3d}
% https://tex.stackexchange.com/questions/7199/can-pstricks-or-others-draw-the-4-common-tangent-lines-of-2-disjoint-circles-w --> some help from Herbert's solution!
\usepackage{pst-eucl}
\begin{document}
    \begin{pspicture}
        %set a few nodes at desired locations and employ the Bezier trick
    \pnodes(-1.8,2){M1}(3,4.2){M2}(2,-1.5){M3}(-1.7, 3){M4}
    \psdots(M1)(M2)(M3)
    \pstCircleABC[CodeFig=true, CodeFigColor=white,linecolor=red, PointSymbol=none, PointName={}]{M1}{M2}{M3}{M4}{O}
    \pstTriangle(0,4){C}(0,0){A}(3,0){B} 
    \pstMiddleAB{A}{B}{I1} \pstArcOAB{I1}{A}{B}
    \pstMiddleAB{B}{C}{I2} \pstArcOAB{I2}{B}{C}
    \pstMiddleAB{C}{A}{I3} \pstArcOAB{I3}{C}{A}
    \end{pspicture}
    
\end{document}

to get:

enter image description here

PS: Of course this solution is not sophisticated, but this can be achieved without too much calculations or whatsoever. Only, some trial-and-error to place the points is required.