# TiKZ image of a triple cover of a circle

I would like to make a TiKZ image of this picture.

It shows a circle lying coiled three times around, stacked over another circle. (For topologists, a degree three map of the circle to itself.) I can get the regular helix part, for example by using How to draw vertical spiral using TiKZ?

I think it will be hard to 'freehand' the curve linking the top endpoint of the helix to the bottom endpoint.and I think there must be a better, more systematic way than trial and error fitting a curve to control points.

But I cannot find a better way.

This is a proposal that uses the show path construction decoration to decompose the path into little stretches which first get drawn white and then a bit thinner black. That way there is a "rubout" effect for the later parts of the curve. The length of the segments depends on the number of samples of the plot. For your convenience I stored the widths in pgf keys, so you can say

\draw[rubout={line width=2pt,halo=0.5pt},decorate] ...


MWE:

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[declare function={f(\x)=0.2*sin(\x)+\x/1000;},
rubout/.style={/utils/exec=\tikzset{rubout/.cd,#1},
decoration={show path construction,
curveto code={
\draw [white,line width=\pgfkeysvalueof{/tikz/rubout/line width}+2*\pgfkeysvalueof{/tikz/rubout/halo}]
(\tikzinputsegmentfirst) .. controls
(\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)  ..(\tikzinputsegmentlast);
\draw [line width=\pgfkeysvalueof{/tikz/rubout/line width},shorten <=-0.1pt,shorten >=-0.1pt] (\tikzinputsegmentfirst) .. controls
(\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb) ..(\tikzinputsegmentlast);
}}},rubout/.cd,line width/.initial=2pt,halo/.initial=0.5pt]
\draw[rubout={line width=2pt,halo=0.5pt},decorate]
plot[variable=\x,domain=-50:970,samples=55,smooth] ({cos(\x)},{f(\x)}) to[out=0,in=195] cycle;
\draw[line width=2pt] (0,-2) arc(-90:270:1cm and 0.2cm);
\draw[thick,-stealth]  (0,-0.4) -- (0,-1.4) node[midway,right]{$p$};
\end{tikzpicture}
\end{document}


• Wow. Impressive. But I don't know these commands, so i cannot alter this. (Well, i can change the line widths.). Can you tell me how to change the beginning and end points of the vertical part of the curve? For my purposes that part of the curve needs to slant noticeably rightwards as it descends, with no appearance of verticality. – Colin McLarty Jun 14 '19 at 0:23
• @ColinMcLarty I modified the answer accordingly. Now it is easier to use, has no vertical stretch, and also the (viewer-dependent) little gaps are gone. – user121799 Jun 14 '19 at 2:29
• @RaoulKessels Yes. But for my purpose it is actually a tough call about the graphics. Either way has some advantages. As you see, the original has the advantage of (correctly) suggesting that at the first and third places the connecting line crosses the coils it is "far from" the coil line and only looks near in the projection, while at the second and fourth it is "near" . But marmot's result has the advantage of being clear that the lines never never coincide, and all crossing points are due to the projection. – Colin McLarty Jun 14 '19 at 10:57
• Oh my, now I see how this works. This MWE has taught me a lot. – Colin McLarty Jun 14 '19 at 11:12