Found several questions here obviously related to what I want, TikZ outline stroke of a compound shape, How to outline the union of an annulus and a rectangle in TikZ?, TikZ: Drawing an arc from an intersection to an intersection and some others, but still could not figure out how to adapt them for my needs.
I have this:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,intersections}
\begin{document}
\begin{tikzpicture}
\clip (-4,-1) rectangle (4,3);
\coordinate (a) at (-4,-3);
\coordinate (va) at (3,7.5);
\shadedraw[name path=higher,opacity=.3] (a) .. controls ($(a)+(va)$) .. ($(a)+(6,0)$);
\coordinate (b) at (4,-5);
\coordinate (vb) at (-3,7.5);
\shadedraw[name path=lower,opacity=.3] ($(b)-(6,0)$) .. controls ($(b)+(vb)$) .. (b);
\path [name intersections={of=higher and lower,by=x}];
\coordinate (xa) at (-1.65,3.45);
\coordinate (xb) at (1,.75);
\draw[thick] (a) .. controls ($(a)+.89(va)$) and ($(x)+(xa)$) .. (x)
.. controls ($(x)+(xb)$) and ($(b)+.6(vb)$) .. (b);
\end{tikzpicture}
\end{document}
and the result is
but it took me quite some effort to find, by blind trial-and-error, the six decimals in the code, and, if you look attentively, the picture is still not entirely accurate.
Is there a better way to draw that thick line?




welddo? – მამუკა ჯიბლაძე May 23 '21 at 13:33weldis what produces the nice join. When anspathisused then there are a variety of options for how it combines with whatever is already there. Using theweldoption makes it into a contiguous path. Without that it would be two separate components. It's the difference between\draw (0,0) -- (1,0) -- (1,1);and\draw (0,0) -- (1,0) (1,0) -- (1,1);– Andrew Stacey May 23 '21 at 16:34