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

\documentclass[border=15pt,pstricks,12pt]{standalone}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}[showgrid](-5,-5)(10,10)
\psset{unit=2cm,PointSymbol=none,PointName=none}
\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}


See the result from Asymptote(TranLeNam's code)

\documentclass[border=5pt,varwidth]{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}
settings.outformat="pdf";
settings.prc=false;
settings.render=20;

unitsize(0.5cm);
import geometry;
defaultpen(fontsize(12pt));
pair A=(0,0), B=(8,0), C=(0,6);
draw(triangle(A,B,C));
pair CP=midpoint(A--B), BP=midpoint(A--C), AP=midpoint(C--B);
draw(arc(CP,A,B)^^arc(BP,C,A)^^arc(AP,B,C)) ;
inversion inv=inversion(20,A);
point AB=inv*B;
point AC=inv*C;
point AA=AB+AC;
circle cABC=excircle(AB,AC,AA);
draw(inv*cABC,red);
shipout(bbox(1mm,1mm+white));
\end{asy}
\end{document}


Of course it does not have center and radius!! It uses inversion which PSTricks does not have !?

I truly do not know how to draw it for PSTricks.

• ah! that was exactly my comment in your other question in its original formulation! since then I have determined the coordinates of all three points of tangency, of the center, and the radius in terms of a, b, c... good luck. – user4686 Jan 28 '19 at 9:38
• notice that you have another remarkable circle which is tangent internally to big semi-circle and externally to the (non-drawn) other small half-semi-circles. You obtain it in the asy code by using inscribed rather than ex-scribed circle. (and using the two other exscribed circles you have in total 4 remarkable circles with the red one in your picture one of them) – user4686 Jan 28 '19 at 9:44
• @jfbu Oh no, I simply want to know if PStricks has any syntax to draw like Asymptote. :-)) – user173875 Jan 28 '19 at 9:53
• Yes that's good question (I don't know enough PSTricks to answer). The specific geometric problem here is something else (to which I devoted some hours over the last week-end to convert the construction (as you give in asy code) into explicit formulas... :) ) – user4686 Jan 28 '19 at 9:54
• @jfbu Oh, no problem, if you have any ways to solve my problem, feel free to post your solution. :-) – user173875 Jan 28 '19 at 10:00

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
/p2y BC AC add AC mul 2 mul BC 3 mul AC 2 mul add AB 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}


As an animated gif:

• Is it possible to find the big circle by compass-and-straight-edge construction, starting from the given triangle? – AlexG Jan 28 '19 at 10:12
• @AlexG Yes it is. It is the Apollonius CCC problem. However that's quite a mess ... – user151328 Jan 28 '19 at 10:13
• Amenable to a nice animation, perhaps? – AlexG Jan 28 '19 at 10:15
• hi, it changes nothing, but regarding top of answer it is B=(c,0), C=(b,0), i.e. AB=c and AC=b as one sees you do in the postscript instruction. – user4686 Jan 28 '19 at 10:26

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}


• Wow!!! What an approach!!! – user151328 Jan 28 '19 at 11:06

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{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:

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{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:

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.

• Seem you misunderstood my idea. I want to draw a circle " tangent " and of course without center and radius... – user173875 Jan 28 '19 at 9:33
• @Chishimotoji Ohhh, I am sorry. Could you update your question accordingly. I could not get understand that straightaway from your question. – Raaja_is_at_topanswers.xyz Jan 28 '19 at 9:54
• Yes, I updated it. – user173875 Jan 28 '19 at 9:57