如何在 tikz 中绘制弯曲边界

如何在 tikz 中绘制弯曲边界

我想要一张类似这样的照片

https://i.imgur.com/76sXujw.png

我能够使用 ipe 进行绘制,但不能使用 tikz。到目前为止,我用 tikz 做的最好的事情是使用椭圆

\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=0.6,x=1.0cm,y=1.0cm]
\draw [rotate around={-0.38:(6.76,1.19)},line width=1.1pt] (6.76,1.19)   ellipse (5.02cm and 2.05cm);
\draw [line width=1.1pt] (7.71,3.2) to  [bend right=70]  (6.48,-0.86);
\draw (2.56,1.54) node[anchor=north west] {$ \Omega_1$};
\draw (9.18,1.54) node[anchor=north west] {$ \Omega_2 $};
\end{tikzpicture}
\end{document}

提前致谢,

答案1

\documentclass[tikz, border = 3pt]{standalone}

\begin{document}
\begin{tikzpicture}[scale = 2]
  \coordinate (0) at (0, 0);

  \coordinate (c1) at (2, 0);
  \coordinate (c2) at (1, 1);
  \coordinate (c3) at (0.3, 0.8);
  \coordinate (c4) at (-1, 0);
  \coordinate (c5) at (0.4, -0.4);

  \draw[black, thick] plot [smooth cycle] coordinates {(c1) (c2) (c3) (c4) (c5)};

  \draw[black] (c3) edge[thick, out=240, in=80] (c5);

  \node[left = 1cm] at (c1){$\Omega_2$};
  \node[right = 1cm] at (c4){$\Omega_1$};

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

替代版本:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=0.4,x=10mm,y=10mm]
\draw (0,0) .. controls (0,1.5) and (7,5) .. node[pos=.6] (t) {} (9,5) .. controls (11,5) and (13,3) .. (13,2) .. controls (13,0) and (7,-1) .. node[pos=.6] (b) {} (4,-1) .. controls (3,-1) and (0,-1) .. cycle;

\draw (t.center) to[out=270,in=70]  (b.center);

\node at (3.5,.75) {$\Omega_1$};
\node at (10,2.5) {$\Omega_2$};
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案3

另一种基于情节的解决方案。

更新:使代码更易于阅读和调整。只需使用该函数即可f

\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\tikzset{declare function={f(\x)=2*(1.25+0.8*sin(\x/2+120)+0.2*cos(\x))*sin(\x);}}
\begin{tikzpicture}[scale=0.6,x=1.0cm,y=1.0cm]
\begin{scope}[rotate=10]
%\draw [rotate around={-0.38:(6.76,1.19)},line width=1.1pt] (6.76,1.19)   ellipse (5.02cm and 2.05cm);
\draw [thick,variable=\x,domain=0:360,samples=80] plot ({5*cos(\x)},{f(\x)});
\draw [thick,variable=\x,domain=0:360,samples=80] plot
({-0.3*sin(\x)},{f(90)-1*(\x/360)*(f(90)-f(270))});
\draw (-2.56,1) node[anchor=north west] {$ \Omega_1$};
\draw (2.56,1) node[anchor=north west] {$ \Omega_2 $};
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容