2

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.

enter image description here

3
  • Hi and welcome. Do you want the connecting arc to be a true arc (part of a circle) or any Bezier curve? – Symbol 1 Dec 20 '20 at 10:54
  • 1
    @Symbol1: With the given constrains, it is not possible to make a true arc - but it is close. – hpekristiansen Dec 20 '20 at 11:22
  • It can be a true arc of an ellipse. – user231225 Dec 20 '20 at 21:41
7
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[scale=2]
\pgfmathsetmacro{\rbez}{0.08}
\filldraw[fill=yellow] (45:0.4)
        arc[start angle=45,end angle=-45,radius=0.4]
        .. controls +(45:\rbez) and +(180:\rbez) .. (0.5,-0.2)
        .. controls +(0:\rbez) and +(135:\rbez) .. ($(1,0)+(225:0.4)$)
        arc[start angle=225,end angle=135,radius=0.4]
        .. controls +(225:\rbez) and +(0:\rbez) .. (0.5,0.2)
        .. controls +(180:\rbez) and +(-45:\rbez) .. cycle;
\draw (45:0.4) arc[start angle=45,end angle=315,radius=0.4];
\draw ($(1,0)+(-135:0.4)$) arc[start angle=-135,end angle=135,radius=0.4];
\end{tikzpicture}
\end{document}

enter image description here

1
  • amazing, thank you – aosborne Dec 20 '20 at 10:44
8

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

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

enter image description here

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.

1
  • 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. – aosborne Dec 20 '20 at 20:25
4

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)
 arc[radius={sqrt(0.5)-0.4}, start angle=-135, end angle=-45]
 arc[radius=0.4, start angle=135, end angle=225]
 arc[radius={sqrt(0.5)-0.4}, start angle=45, end angle=135]
 arc[radius=0.4, start angle=-45, end angle=45];
\draw (0,0) circle[radius=0.4];
\draw (1,0) circle[radius=0.4];
\end{tikzpicture}
\end{document}

Circles with bridge

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.