[Tex/LaTex] tikz: draw a piece of a path between given coordinates

tikz-pgf

I have a path in my application that I want to split up in smaller paths. These, I would like to draw with a label attached to them. Take the following image as an example:

What I am trying to achieve

The upper arc is split up into three segments by the horizontal lines and by the two lines coming out of the center of the circle. I draw all three parts of the path and attach a label to them.

Now, the way I do this now is a bit tedious. For each segment I have to reconstruct the path by hand: I have to specify how the path is continued at each intersection. In this case the intersection is simple and the continuation is clear, but if the path is complicated this becomes more difficult.

What I would like to do is the following:

  1. Define a full path, in this case the upper arc from the the left all the way to the right. This path could be arbitrarily complicated.
  2. Find coordinates in the path by intersecting with other paths.
  3. Have a command to say: draw the path from the first intersection coordinate to the second and assign a label to this segment. Draw the path from the second intersection to the third, etc.

How can I achieve this?

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.multipart,fit,shapes,calc,backgrounds,decorations.pathreplacing,decorations.markings,intersections}

\begin{document}

\begin{tikzpicture}[scale=2]
\path[name path=t] (1,0) to[out=90,in=180] (2,1) to[out=0,in=90] (3,0); % top arc
\path [name path=ml] (2,0) -- (1,1);
\path [name intersections={of=ml and t}];
\coordinate (A) at (intersection-1);
\path [name path=l] (2,0) -- (3,1);
\path [name intersections={of=l and t}];
\coordinate (B) at (intersection-1);

\draw[thick,draw=blue,] (3,0) to[out=90,in=315] node[midway,above right] {$c$} (B) to[out=135,in=45] node[midway,above] {$b$} (A) to[out=225,in=90] node[midway,above left] {$a$} (1,0);
\draw[thick,draw=blue,] (1,0) -- (0,0) node[midway,above] {};

\draw[thick,draw=blue,] (1,0) to[out=-90,in=180] node[midway,below left] {} (2,-1);
\draw[thick,draw=blue,] (2,-1) to[out=0,in=-90] node[midway,below right] {} (3,0);
\draw[thick,draw=blue,] (4,0) -- (3,0) node[midway,above] {};

\draw[thick,draw=blue,] (2,0) -- node[midway,right] {} (2,-1);
\draw[thick,draw=blue,] (A) -- node[midway,below left] {} (2,0);
\draw[thick,draw=blue,] (2,0) -- node[midway,below right] {} (B);
\end{tikzpicture}
\end{document}

Best Answer

This is a very late answer and the tools used in it were, if I am not mistaken, not available at the time you asked the question. I found this question with this query, and the purpose of this answer is just to mention that now rather convenient means to do what you suggest. The new tool is the pgfplots library fillbetween that allows you to split paths in segments, which you can redraw, fill, or use in other ways.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{calc,shapes.multipart,fit,shapes,calc,backgrounds,decorations.pathreplacing,decorations.markings,intersections}
\usepgfplotslibrary{fillbetween}
\begin{document}

\begin{tikzpicture}[scale=2]
\path[name path=t] (1,0) to[out=90,in=180] (2,1) to[out=0,in=90] (3,0); % top arc
\path [name path=ml] (2,0) -- (1,1);
\path [name intersections={of=ml and t}];
\coordinate (A) at (intersection-1);
\path [name path=l] (2,0) -- (3,1);
\path [name intersections={of=l and t}];
\coordinate (B) at (intersection-1);


\draw[thick,draw=blue,] (3,0) to[out=90,in=315] node[midway,above right] {$c$} (B) to[out=135,in=45] node[midway,above] {$b$} (A) to[out=225,in=90] node[midway,above left] {$a$} (1,0);
\draw[thick,draw=blue,] (1,0) -- (0,0) node[midway,above] {};

\draw[thick,draw=blue,] (1,0) to[out=-90,in=180] node[midway,below left] {} (2,-1);
\draw[thick,draw=blue,] (2,-1) to[out=0,in=-90] node[midway,below right] {} (3,0);
\draw[thick,draw=blue,] (4,0) -- (3,0) node[midway,above] {};

\draw[thick,draw=blue,] (2,0) -- node[midway,right] {} (2,-1);
\draw[thick,draw=blue,] (A) -- node[midway,below left] {} (2,0);
\draw[thick,draw=blue,] (2,0) -- node[midway,below right] {} (B);

% draw the left segment
\draw[thick,red,
        intersection segments={of=t and ml,sequence={L1}}];
% construct an auxiliary path
\path[name path=aux,%draw=green,thick,
        intersection segments={of=t and ml,sequence={L0}}];
% draw the middle segment
\draw[thick,green!60!black,
        intersection segments={of=aux and l,sequence={L1}}];
% draw the right segment
\draw[thick,purple,
        intersection segments={of=aux and l,sequence={L0}}];
\end{tikzpicture}
\end{document}

enter image description here