I would like to create a tikz-macro that draws a nice rounded polygon around a given list of nodes. Something like:
\myroundpoly{p1,p2,...,pn}{dist}
Here, p1,p2,....,pn are the vertices of a polygon given in a clockwise order and dist is a parameter for the distance of the rounded polygon of these vertices.
A MWE is the following:
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
%Some saple vertices
\node (a1) at (-1,-1) {1};
\node (a4) at (2,-2) {4};
\node (a3) at (3,3) {3};
\node (a2) at (-2,1) {2};
%---------------------------------------------------------------------%
%This is what I would like to type -> \myrondpoly{{a1,a2,a3,a4},0.3cm}%
%---------------------------------------------------------------------%
%----------------------------------%
%And this is what it should compute%
%----------------------------------%
\def\dist{0.3cm}
%Calculate the auxiliary coordinates for the arcs
\foreach \from/\to in {{a1/a2},{a2/a3},{a3/a4},{a4/a1}}{%calculates the points for the arcs and draws the straight lines
\coordinate (\from\to) at ($(\from)!\dist!90:(\to)$);
\coordinate (\to\from) at ($(\to)!\dist!-90:(\from)$);
}
%Draw the straight lines
\foreach \from/\to in {{a1/a2},{a2/a3},{a3/a4},{a4/a1}}
\draw (\from\to) -- (\to\from);
%Draw the arcs
\foreach \pred/\mid/\succ in {{a4/a1/a2},{a1/a2/a3},{a2/a3/a4},{a3/a4/a1}}{
\tkzDrawArc[color=black](\mid,\mid\succ)(\mid\pred)
}
\end{tikzpicture}
\end{document}
Some example outputs of the intended procedure can be seen here:

Here is a list of features that would be nice to have:
the polygons should not be filled, i.e., if two polygons overlap then none obscures the other (except for the lines of course)
special case of 2-polygon and 1-polygon does not break the code
short code with few packages


