# [Tex/LaTex] TikZ – Rounded closed polygon

tikz-pgf

I would like to produce rounded closed polygon like in the following uggly draw. This shape will be defined by giving positions of the vertex. This will be used on sudoku grids.

Assuming you are using the Sudoku code of question TikZ: “Zig-Zag” lines, for example, this code is drawn in such a way that each cell is 1 unit wide, so this makes very easy to draw this kind of shapes, since the vertex will have integer units.

Moreover, if you use relative coordinates (++ syntax) you can specify each point of the polygon as an increment of ++(1,0), ++(0,1), ++(-1,0) or ++(0,-1) with respect of the last drawn point, so you only need to give absolute coordinates for the first point of the path, and this kind of relative coordinates for the remaining ones.

So, for example, your shape would be (assuming that I guessed right the units from your distorted drawing):

\draw[ultra thick, red, rounded corners] (first point) --
++(1, 0) -- ++(0,-1) -- ++(1, 0)  -- ++(1,0) -- ++(0,-1) --
++(0,-1) -- ++(-1,0) -- ++(0,-1) -- ++(-1,0) -- ++(0, 1) --
++(-1,0) -- ++(0, 1) -- ++(0, 1) --  cycle;


Where (first point) can be for example (3,6) to give this: