# Draw concave hull of points 2D

I'd like that:

\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}


To look pretty.

A convex hull approach should do. What I found does not work anymore. And I would like to do it without hobby.

Thanks a lot for the help

Is there another way to draw the shaded areas w/out bezier curves or fiddling with "smooth curves"?

## 1 Answer

A quick hack which is slightly better

\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}


Notice that none of these shapes are convex by the way...

• Indeed, if anything it's concave. Also, nice choice to use the plot, it makes it really easy. – Alenanno Feb 10 '16 at 10:46
• uuuiii... thats so much better thanks. But still not "perfect". probably because the "ellipse" is not perfect but also drawn "by hand", i.e., with precise coordinates...I played with the tension and the distance... it is pretty perfect for being such a nice and easy solution. thanks again – user3710638 Feb 10 '16 at 11:11