# TikZ - Rounded closed polygon

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.

-
In its current form, your question might not receive many answers. Please take a look at the How to Ask-page and try to improve your question according to the guidance found there. This may require you to show some effort on your part in terms of attempting a solution. If you have questions about what to do or if you don't quite understand what this means, please ask for clarification using the `add comment` function. –  Brent.Longborough Feb 11 '13 at 10:51
I've changed my question to be more precise. –  projetmbc Feb 11 '13 at 11:02

Assuming you are using the Sudoku code of question TikZ - "Zig-Zag" arrows, 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:

-
Thanks ! Is there a way to not draw on the line of the grids ? –  projetmbc Feb 11 '13 at 17:50
There is a strange behavior. I've tried (4, 2) instead of (3,6) and the output is not the one expected. No ? –  projetmbc Feb 11 '13 at 18:13
I’d favour the polar-coordinate syntax, i.e. `(3,6) -- ++(right:1) -- ++(down:1) -- ++(right:2) -- ++(down:2) …`. That is probably a bit more intuitive than to deal with all the `1`s and `0`s. –  Qrrbrbirlbel Feb 11 '13 at 18:23
@projetmbc Yes, it is possible not to draw on the line of the grid: Don’t do it. Move the `\draw`ing command before the grid or use layers (or maybe `opacity`?). `(4, 2)` looks right to me … –  Qrrbrbirlbel Feb 11 '13 at 18:25
For the coordinate, it is indeed logical. There is no problem. –  projetmbc Feb 11 '13 at 18:31
show 1 more comment