绘制二维点的凹壳

绘制二维点的凹壳

我想:

\begin{tikzpicture}
\draw[gray!50, dashed, fill=gray!10]  plot[smooth cycle, tension=.7] coordinates {(3.0379,10.2421) (2.0978,9.802)  (1.6332,8.5161) (2.0978,7.3113) (3.3837,6.9169)  (4.3832,8.1703)  (3.8915,9.8182) (3.4377,9.6885)  (3.697,8.9375) (3.6739,8.2269) (3.5241,7.8083) (2.9839,7.5814) (2.5138,7.8299) (2.3301,8.2189) (2.3247,8.9105) (2.5895,9.4994) (3.0271,9.7583) (3.2378,10.0069) };

\draw[gray, fill= white]  plot[smooth cycle, tension=.7] coordinates {(2.1543,9.7544) (1.8119,9.0064) (1.8014,8.1951) (2.149,7.4365) (2.4386,7.3946)(2.4951,7.5912) (2.3387,7.8) (2.207,8.2056) (2.1859,8.9589) (2.4651,9.5595) (2.4335,9.8018)  };
\draw[gray, fill= white]  plot[smooth cycle, tension=.7] coordinates { (2.8014,7.2447) (3.0002,7.0181) (3.8376,7.4287) (4.1764,8.181) (4.185,9.0223) (3.9754,9.2003) (3.8089,8.9907) (3.8146,8.2097) (3.5706,7.7015)(2.9829,7.4097)};


\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (3,       10) (v0) {0};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (2.3, 9.65) (v1) {1};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (2,       9) (v2) {2};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (2,       8.2) (v3) {3};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (2.3, 7.55) (v4) {4};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (3,       7.2) (v5) {5};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (3.7, 7.55) (v6) {6};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (4,       8.2) (v7) {7};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (4,       9) (v8) {8};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (3.7, 9.65) (v9) {9};

\path[->] (v0)  edge [bend right = 15] (v1);
\path[->] (v1)  edge [bend right = 10] (v2);
\path[->] (v2)  edge [bend right = 10] (v3);
\path[] (v3)  edge [bend right = 10] (v4);
\path[] (v4)  edge [bend right = 15] (v5);
\path[->] (v5)  edge [bend right = 15] (v6);
\path[->] (v6)  edge [bend right = 10] (v7);
\path[] (v7)  edge [bend right = 10] (v8);
\path[] (v8)  edge [bend right = 10] (v9);
\path[] (v9)  edge [bend right = 15] (v0);

\path[] (v3)  edge [] (v7);
\path[] (v2)  edge [bend left = 10] (v8) edge [bend left = 10] (v6);
\path[] (v4)  edge [bend left = 10] (v8) edge [bend right = 10] (v6);
\end{tikzpicture}

在此处输入图片描述

为了看起来漂亮。

凸包方法应该可以。我发现它不再有效。我想不用爱好来做这件事。

非常感谢您的帮助

有没有其他方法可以使用贝塞尔曲线或摆弄“平滑曲线”来绘制阴影区域?

答案1

一个稍微好一点的快速破解方法

\documentclass[tikz]{standalone}
\usetikzlibrary{backgrounds}

\begin{document}
\begin{tikzpicture}

\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (3,       10) (v0) {0};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (2.3, 9.65) (v1) {1};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (2,       9) (v2) {2};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (2,       8.2) (v3) {3};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (2.3, 7.55) (v4) {4};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (3,       7.2) (v5) {5};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (3.7, 7.55) (v6) {6};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (4,       8.2) (v7) {7};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (4,       9) (v8) {8};
\node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (3.7, 9.65) (v9) {9};

\begin{scope}[on background layer]
\draw[double=gray!25,double distance=8mm,smooth,line cap=round,tension=0.7] plot coordinates {(v0) (v1) (v2) (v3) (v4) (v5) (v6) (v7)};
\draw[double distance=5mm,smooth,line cap=round,tension=0.8] plot coordinates {(v0) (v1) (v2) (v3) (v4)};
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

顺便说一下,请注意这些形状都不是凸的......

相关内容