如何在 tikz/pgf 中遮蔽两条路径之间的区域?

如何在 tikz/pgf 中遮蔽两条路径之间的区域?

在下面的 tikzpicture 中,我想为标记为 p 和 q 的两条路径之间的区域添加阴影。这类似于填充两个 \draw Tikz 之间的区域但我无法根据我的需要调整那里的答案。

\documentclass{standalone}
\usepackage{tikz}\usetikzlibrary{decorations.pathmorphing,arrows,decorations.text,intersections,patterns}
\tikzset{snake it/.style={decorate, decoration=snake, -> ,>=stealth}}
\begin{document}
  \begin{tikzpicture}   
   \draw[name path = eli] (0,0) ellipse (5 and 2) ;
   \node[label=right:$X$] at (5,0) {};
   \node[label=left:$x$, circle] (x) at (-3,0) {};
   \fill[black, opacity = 1,] (x) circle (2pt);
   \node[label=right:$y$, circle] (y) at (2,1) {};
   \fill[black, opacity = 1,] (y) circle (2pt);
   \path (x) edge 
              [name path=qq, bend right=60, snake it] 
              node[swap,label=below:$q$] {}
              (y) ;
   \path (x) edge 
              [name path=pp, bend left=30, snake it, ->] 
              node[swap,label=above:$p$] {}
              (y) ;
   \fill[pattern color = gray, pattern = north east lines, opacity=0.8] (pp)  (0,0) (qq);
  \end{tikzpicture}
\end{document}

答案1

一个黑客解决方案:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,patterns}
\tikzset{snake it/.style={decorate, decoration=snake, -> ,>=stealth}}
\begin{document}
  \begin{tikzpicture}
    \draw(0,0) ellipse (5 and 2);
    \node[label=right:$X$] at (5,0) {};
    \node[label=left:$x$, circle,] (x) at (-3,0) {};
    \node[label=right:$y$, circle] (y) at (2,1) {};
    \fill[pattern color = gray!80, pattern = north east lines] (x.center) to[bend right=45] (y.center) to[bend right=23] cycle;
    \fill[preaction={draw=white,line width=4pt},black] (x) circle (2pt);
    \fill[preaction={draw=white,line width=4pt},black] (y) circle (2pt);
    \path (x) edge[preaction={pattern color = gray!80, pattern = north east lines}, bend right=60, snake it] node[swap,label=below:$q$] {}(y);
    \path (x) edge[preaction={pattern color = gray!80, pattern = north east lines}, bend left=30, snake it] node[swap,label=above:$p$] {}(y);
  \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容