[Tex/LaTex] Fill area between two curves up to intersection

fillbetweenpgfplots

I want to fill the area between two curves. What I have so far:

\documentclass{article}
\usepackage{tikz,pgfplots}
\usetikzlibrary{patterns}
\usepgfplotslibrary{fillbetween}
\begin{document}

\begin{center}
\begin{tikzpicture}

\begin{axis}[%
width=6cm,
height=5cm,
at={(0cm,0cm)},
scale only axis,
separate axis lines,
every outer x axis line/.append style={black},
every x tick label/.append style={font=\color{black}},
xmin=0,
xmax=2.501,
every outer y axis line/.append style={black},
every y tick label/.append style={font=\color{black}},
ymin=0,
ymax=2.501,
axis background/.style={fill=white}
]

\addplot [color=red,name path=A]
table[row sep=crcr]{%
    0                   0.6\\
    1                   1\\
    2.5109328918269 1.38577280784458\\
};
\addplot [color=blue,name path=B]
table[row sep=crcr]{%
    0                   -1\\
    0.587895504187662   0\\
    1                   1\\
    1.38809536149591    2.5121495529328\\
};

\addplot[pattern=north east lines] fill between[of=A and B ];
\end{axis}
\end{tikzpicture}%
\end{center}
\end{document}

This results in:

enter image description here

However, I want to fill only the area left to the intersection. I already tried soft clip etc. but without success.

Best Answer

You can use intersection segments:

\fill[
    intersection segments={
      of=A and B,
      sequence={L1--R1[reverse]}
    },
    pattern=north east lines,
  ]-- cycle;

L1 is the first segement of the left path (in the example path A) and R1[reverse] is the reversed first segment of the right path (in the example path B).

enter image description here

Code:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{patterns}
\usepgfplotslibrary{fillbetween}
\begin{document}

\begin{center}
\begin{tikzpicture}

\begin{axis}[%
width=6cm,
height=5cm,
at={(0cm,0cm)},
scale only axis,
separate axis lines,
every outer x axis line/.append style={black},
every x tick label/.append style={font=\color{black}},
xmin=0,
xmax=2.501,
every outer y axis line/.append style={black},
every y tick label/.append style={font=\color{black}},
ymin=0,
ymax=2.501,
axis background/.style={fill=white}
]

\addplot [color=red,name path=A]
table[row sep=crcr]{%
    0                   0.6\\
    1                   1\\
    2.5109328918269 1.38577280784458\\
};
\addplot [color=blue,name path=B]
table[row sep=crcr]{%
    0                   -1\\
    0.587895504187662   0\\
    1                   1\\
    1.38809536149591    2.5121495529328\\
};

\fill[
    intersection segments={
      of=A and B,
      sequence={L1--R1[reverse]}
    },
    pattern=north east lines,
  ]-- cycle;
\end{axis}
\end{tikzpicture}%
\end{center}
\end{document}