# tikz tangent arc between two circles

I made a terrible MSPaint illustration below to try and communicate what I'm looking to achieve. I have two circles of radius 0.4 located at (0,0) and (1,0), respectively. I am using TikZ.

I am trying to draw a smooth and symmetric arc (hand-approximated in red) subject to the following constraints:

1. The end-points are tangent to each circle and are located on the outer edge of the circle. The end-points are defined on each circle by the same 45deg polar angle(albeit, in opposite facing directions).
2. The mid-point is located at (0.5, 0.2) with a flat tangent.

It may be true that defining an arc according to the above requires additional constraints; if a symmetric pair of control points can also be included so I might play with the concavity that would also be ideal.

Eventually I will want to put the same curve on the underside of the two circles as well, and fill with color the area in between.

• Hi and welcome. Do you want the connecting arc to be a true arc (part of a circle) or any Bezier curve? Dec 20, 2020 at 10:54
• @Symbol1: With the given constrains, it is not possible to make a true arc - but it is close. Dec 20, 2020 at 11:22
• It can be a true arc of an ellipse.
– user231225
Dec 20, 2020 at 21:41

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=2]
\pgfmathsetmacro{\rbez}{0.08}
\filldraw[fill=yellow] (45:0.4)
.. controls +(45:\rbez) and +(180:\rbez) .. (0.5,-0.2)
.. controls +(0:\rbez) and +(135:\rbez) .. ($(1,0)+(225:0.4)$)
.. controls +(225:\rbez) and +(0:\rbez) .. (0.5,0.2)
.. controls +(180:\rbez) and +(-45:\rbez) .. cycle;
\draw ($(1,0)+(-135:0.4)$) arc[start angle=-135,end angle=135,radius=0.4];
\end{tikzpicture}
\end{document}


• amazing, thank you Dec 20, 2020 at 10:44

With the in and out syntax you can set the angles explicitly.

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
to[out=-45,in=180] (0.5,0.2)
to[out=0,in=-135] ([xshift=1cm]135:0.4)
(0.5,-0.2) to[out=180,in=45] cycle;
\end{tikzpicture}
\end{document}


This is result is not unique. Even if you demand symmetry, there are two parameters that you can vary, in looseness and out looseness. An overall looseness roughly corresponds to \rbez from polyn's nice answer, but you can actually introduce two of them.

• thank you- this is also a very nice answer. the in/out syntax is new to me; this is good to know how to use. Dec 20, 2020 at 20:25

If you are willing to have the midpoint not exact at (0.5,0.2) but less than a line width below, the bridge can be drawn with arcs alone, and there is no extra tension parameter.

\documentclass[tikz, border=0.1cm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\draw[fill=red]
(45:0.4)