# How to clip with a path between customized, bent sides (e.g. as drawn by edges from graphs)?

In the next MWE, I tried to clip by using a path drawn by edges between nodes, a circle, but I didn't succeed. It's not essential to draw it using automata, though. But the point is:

being able to clip with a path made (custom) bent edges

path which, for instance, as in the MWE, can be drawn with edges between nodes. The circle thereafter should have been cropped by the path.

So I guess the solution is to redeclare the nodes as coordinates, draw a path between them and clip as usual. But then I lose the possibility of drawing with the edge-options (bending-angle)

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{automata}

\begin{document}

\begin{tikzpicture}

\node (A) at (1,1) {a};
\node (B) at (2,2) {b};
\node (C) at (3,1) {c};

\path[draw]
(A) edge[bend right=-30,red,->] (B)
(B) edge[bend right=-30,blue,dashed] (C)
(C) edge[bend right=-30,green,dotted] (A);
\begin{scope}[xshift=3cm]

\node (A) at (1,1) {a};
\node (B) at (2,2) {b};
\node (C) at (3,1) {c};

\path[clip]
(A) edge[bend right=-30,red,->] (B)
(B) edge[bend right=-30,blue,dashed] (C)
(C) edge[bend right=-30,green,dotted] (A);
\path[fill=blue!50] (2, 1.7) circle (.8);
\end{scope}

\end{tikzpicture}

\end{document}


What did go wrong? Why wasn't the circle cropped by the path? Can another process do this well? By adding -- cycle it didn't work either.

The wanted effect, here manually adjusted, is something like:

The solution might need not to use automata, as long as I can bend the (substitute of the) on each edge independently.

\path[clip]
(A) edge[bend right=-30,red,->] (B)
(B) edge[bend right=-30,blue,dashed] (C)
(C) edge[bend right=-30,green,dotted] (A) -- cycle;
\path[fill=blue!50] (2, 1.7) circle (.8);

• It is not particularly clear what exactly you want. Exactly what are you trying to do, and why do you need clipping to achieve it? – daleif Jul 15 '16 at 12:34
• I can not reproduce your image. Right one is without edges. And as @daleif already said, what is purpose of clipping? – Zarko Jul 15 '16 at 12:41
• To clarify what I said before: my test show left part of your images as it is and right part image without edges and blue circle, just nodes a, b and c. Is this your goal? – Zarko Jul 15 '16 at 13:37
• Problem is that the edge structure does not generate a closed curve. You are essentially drawing each edge on its own, and this the clipping area is a line with area zero, thus no clipping. You could use to instead of edge and remove the duplicated targes, but that will not give a path that follows that curved arrows. I would (1) update the question with a better explanation, (2) see if there is a better method. How is automata related to diff geo? (just out of curiosity) – daleif Jul 15 '16 at 13:54
• @daleif I don't now what automata are. I use the automata-package to draw graphs. Some graphs encode manifolds (so-called GEMs), being this not the only constructon (way nicer yet: Groethendiek dessins d'enfant). With some luck, one can also illustrate your graph drawn on a manifold, which I try for a surface. – c.p. Jul 15 '16 at 15:37

Just to prove it can be done:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{automata}

\begin{document}

\begin{tikzpicture}

\begin{scope}[xshift=3cm]

\node (A) at (1,1) {a};
\node (B) at (2,2) {b};
\node (C) at (3,1) {c};

\begin{scope}

\path[draw]
(A)
edge [bend right=-30,red,->]
coordinate[pos=1] (Bl)
coordinate[pos=0] (At)
(B)
(B)
edge [bend right=-30,blue,dashed]
coordinate[pos=1] (Ct)
coordinate[pos=0] (Br)
(C)
(C)
edge [bend right=-30,green,dotted]
coordinate[pos=1] (Ar)
coordinate[pos=0] (Cl)
(A);

\path[
clip,
%draw,
%green
]
(At) to [bend right=-30] (Bl)
to [bend right=-10]  (Br) to [bend right=-30]
(Ct) to (Cl)
to [bend right=-30] (Ar)
to (At) to cycle
;

\fill[opacity=0.1] (2, 1.7) circle (.8);
\end{scope}
\end{scope}

\end{tikzpicture}

\end{document}