# fuse different paths

Suppose that we have four nodes a, b, c, and d. For example :

\coordinate [label=left:a]  (a) at (0,4);
\coordinate [label=right:b] (b) at (4,4);
\coordinate [label=left:c]  (c) at (0,0);
\coordinate [label=right:d] (d) at (4,0);


Let's draw some arbitrary paths between every couple in {(a,b), (a,c), (c,d), (d,b), (b,a)}. Example :

\draw [red]    (a) to [bend left=30]                   (c);
\draw [blue]   (b) to [out=45, in= -50]                (a);
\draw [orange] (c) to [controls=+(45:6) and +(170:6)]  (d);
\draw [green!60!black,decorate,decoration={snake,pre length=1pt}] (d) -- (b); To my knowledge

\path (a) -- (c) -- (d) -- (b) -- cycle;


is considered as one path, so therefore we can fill the area inside this path; But in the example above we have four paths and therefore the fill area is senseless for tikZ.

My Question : Is it possible to fuse all of paths (in example) to create one fillable path like \fill [blue!10] (a) -- (c) -- (d) -- (b) -- cycle; or something else ? In other way, I want to hatch the surface S.

All code :

\documentclass[tikz, border=1cm]{standalone}

\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\mathversion{bold}

\begin{document}

\begin{tikzpicture}
\coordinate [label=left:a]  (a) at (0,4);
\coordinate [label=right:b] (b) at (4,4);
\coordinate [label=left:c]  (c) at (0,0);
\coordinate [label=right:d] (d) at (4,0);

\foreach \p in {a,b,c,d}{
\fill[red] (\p) circle (2pt);}

\draw [red]    (a) to [bend left=30]                   (c);
\draw [blue]   (b) to [out=45, in= -50]                (a);
\draw [orange] (c) to [controls=+(45:6) and +(170:6)]  (d);
\draw [green!60!black,decorate,decoration={snake,pre length=1pt}] (d) -- (b);
\node at (2,2.5) {$S$};

\end{tikzpicture}

\end{document}


To be more clear, I encountered this problem when creating a (breakable) tcolorbox I want to fill the empty surface S, but with four paths I cannot do it. Yes, of course. You cannot draw the path in different colors, but certainly you can combine the stretches to be filled, and draw the colored stretches either explicitly separately, or via edges.

\documentclass[tikz, border=1cm]{standalone}

\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\mathversion{bold}

\begin{document}

\begin{tikzpicture}
\coordinate [label=left:a]  (a) at (0,4);
\coordinate [label=right:b] (b) at (4,4);
\coordinate [label=left:c]  (c) at (0,0);
\coordinate [label=right:d] (d) at (4,0);

\foreach \p in {a,b,c,d}{
\fill[red] (\p) circle (2pt);}
\path[decoration={snake,pre length=1pt},fill=blue!20]
(a) to [bend left=30]                   (c)
to [controls=+(45:6) and +(170:6)](d)
decorate {  -- (b)}
to [out=45, in= -50]   cycle;
\draw [red]    (a) to [bend left=30]                   (c);
\draw [blue]   (b) to [out=45, in= -50]                (a);
\draw [orange] (c) to [controls=+(45:6) and +(170:6)]  (d);
\draw [green!60!black,decorate,decoration={snake,pre length=1pt}] (d) -- (b);
\node at (2,2.5) {$S$};
\end{tikzpicture}

\end{document} and adding even odd rule, i.e.

\path[decoration={snake,pre length=1pt},fill=blue!20,even odd rule]
(a) to [bend left=30]                   (c)
to [controls=+(45:6) and +(170:6)](d)
decorate {  -- (b)}
to [out=45, in= -50]   cycle;


yields • Thanks for help Jun 14, 2020 at 13:43
• @schrödingers if you don't mind, i want to ask about two Special cases: 1.if we want to draw nothing between two node and conserve the path for example not drawing the blue and orange curves, but conserve the whole path (to fill it later); 2. save the decoration you can see that if we use the following code : [d1/.style={decoration={random steps,segment length=1pt,amplitude=3pt}}] \draw [blue,d1,fill=blue!10] (a) decorate { -- (c)} to (d) decorate { -- (b)} to cycle; \draw [red,d1] (a) decorate { -- (c)};  We will get bad results Jun 14, 2020 at 17:30
• @BahaedineMadir I do not understand the first point. The second is not an executable code, but I think that you are saying that there will always be new random numbers, so random decorations do not match when redrawn. This is correct. I think that there is a chance that one can work with the save path key. However, as this deviates quite a bit from the original question, I'd kindly ask you to use a new question for these follow-up questions, in which you explain the problem as well as in this nice question, which is very clear and useful.
– user194703
Jun 14, 2020 at 19:28
• @schrödingers, ok i will; thank you! Jun 15, 2020 at 1:31