Tikz 填充三个节点的区域

Tikz 填充三个节点的区域

考虑一下这个MWE:

\documentclass[tikz, border=10pt]{standalone}
\usetikzlibrary{calc,positioning}

\begin{document}

\begin{tikzpicture}[scale=1,font=\Large]
    \tikzstyle{dag} = [-,thick,draw=blue!50];
    \node[minimum height=0pt, minimum width=0pt] (matha) at (0,0) {};
    \node (gun) [below=1cm of matha] {c};
    \node (a2) [left=1.3cm of gun] {a};
    \node (a1) [left=0.4cm of gun] {b};
    \node (b1) [right=0.4cm of gun] {d};
    \node (b2) [right=1.3cm of gun] {e};
    \draw[draw=blue, fill=blue!50] (a2.north) -- (0,0.37) -- (b2.north) -- cycle;
    \draw[fill=blue!20,dag] (a2.90) to[bend left=35] (0,0.37);
    \draw[fill=white,dag] (a1.90) to[bend left=40] (0,0.37);
    \draw[fill=blue!20,dag] (b2.90) to[bend right=35] (0,0.37);
    \draw[fill=white,dag] (b1.90) to[bend right=40] (0,0.37);
    \draw[fill=white,dag] (a2.north) to[out=60,in=120] (a1.north);
    \draw[fill=white,dag] (a1.north) to[out=60,in=120] (gun.north);
    \draw[fill=white,dag] (gun.north) to[out=60,in=120] (b1.north);
    \draw[dag] (b1.north) to[out=60,in=120] (b2.north);
\end{tikzpicture}

\end{document}

我想做这个,但做不到。我该怎么做?

在此处输入图片描述

答案1

\documentclass[tikz, border=10pt]{standalone}
\usetikzlibrary{calc,positioning}
\begin{document}
\begin{tikzpicture}[scale=1,font=\Large]
\tikzset{dag/.style = {thick,draw=blue!50}};
\node[minimum height=0pt, minimum width=0pt] (matha) at (0,0) {};
\node (gun) [below=1cm of matha] {c};
\node (a2) [left=1.3cm of gun] {a};
\node (a1) [left=0.4cm of gun] {b};
\node (b1) [right=0.4cm of gun] {d};
\node (b2) [right=1.3cm of gun] {e};
\fill[blue!20] (0,0.37) to[bend right=35] (a2.north) to[out=60,in=120] (a1.north) to[out=100,in=200] cycle (0,0.37) to[bend left=35] (b2.north) to[out=120,in=60] (b1.north) to[out=80,in=-20] cycle;
\draw[dag, miter limit=1] (a2.north) to[out=60,in=120] (a1.north) to[out=60,in=120] (gun.north) to[out=60,in=120] (b1.north) to[out=60,in=120] (b2.north)  to[bend right=35] (0,0.37) to[bend right=35] cycle (a1.north) to[out=100,in=200] (0,0.37) (b1.north) to[out=80,in=-20] (0,0.37);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

也许是这样的?

\documentclass[tikz,border=2mm]{standalone}

\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,draw=blue!50,thick]
\foreach[count=\ii from -2]\i in {a,...,e}
  \node[yshift=-3mm] at (\ii,0) {\strut\i};
\draw (-1,0) to[out=60,in=120] (0,0)    to[out=60,in=120]            (1,0);
\foreach\i in {-1,1}
  \draw[fill=blue]             (2*\i,0) to[out=90+30*\i,in=90-30*\i] (\i,0) 
     to[out=90,in=90-120*\i]   (0,2)    to[out=90-90*\i,in=90]       (2*\i,0);
\end{tikzpicture}

在此处输入图片描述

相关内容