
Ao tentar responderComo deletar uma parte de uma curva no Tikz?, tive problemas com intersection segments
from PGFPlots fillbetween
. Tentei mudar a curva to[out=280,in=175]
para pontos de controle e várias outras coisas. Sempre obtenho o mesmo resultado:
- vermelho L1 parece certo.
- verde L2 segue a curva, mas tem um ponto final errado.
- azul L3 tem pontos finais corretos, mas não segue a curva.
O que estou fazendo de errado?
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\draw[name path=curve] (0.3,5) to[out=280,in=175, looseness=0.92] (5.5,0.5); %a curve
%\draw[name path=curve] (0.3,5) .. controls (1,1) and (2,0) .. (5.5,0.5); %alternative curve
\draw[name path=line] (0,4.1) -- (4.1,0);
\draw[red, ultra thick, opacity=0.5, smooth, intersection segments={of=curve and line, sequence={L1}}];
\pgfgetlastxy{\XCoord}{\YCoord}
\draw (\XCoord,\YCoord) circle (1pt);
\draw[green, ultra thick, opacity=0.5, smooth, intersection segments={of=curve and line, sequence={L2}}];
\pgfgetlastxy{\XCoord}{\YCoord}
\draw (\XCoord,\YCoord) circle (1pt);
\draw[blue, ultra thick, opacity=0.5, smooth, intersection segments={of=curve and line, sequence={L3}}];
\pgfgetlastxy{\XCoord}{\YCoord}
\draw (\XCoord,\YCoord) circle (1pt);
\end{tikzpicture}
\end{document}