# How to draw a irregular circle(shape)?

I want to draw some irregular circle(shape) in my wireless scenario.

with a basestation in the center.

around is some irregular circle(shape).

I find something(could be used) in this web(but I feel it's size is too large)

Now my teacher want me use this circle as small as possible, but I find when I turn the radius smaller, the irregularcicle's round isn't clear so much. Is there any idea to solve this problem?

-
I don't understand your latest request. What is the problem with small irregular circle? Can you show a picture? –  Paul Gaborit Aug 1 '13 at 11:47

With PSTricks (just for typing exercise).

## Single

• Verbose:

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot}
\pstVerb{realtime srand}
\psset{plotpoints=50}
\def\points{}

\begin{document}
\begin{pspicture}(-2,-2)(2,2)
\multido{\i=0+1}{\Xnodecount}{\xdef\points{\points (X\i)}}
\expandafter\psccurve\points
\end{pspicture}
\end{document}

• Compact:

\psnccurve is a new macro (among others) in pst-node to pass an array of nodes to \psccurve without creating the concatenating macro \points (as used in the code above). Now I can save more keystrokes.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot}
\pstVerb{realtime srand}
\psset{plotpoints=50}

\begin{document}
\begin{pspicture}(-2,-2)(2,2)
\psnccurve(0,\Xnodecount){X}
\end{pspicture}
\end{document}


## Multiple

• Verbose:

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot}
\pstVerb{realtime srand}
\psset{plotpoints=50}

\begin{document}
\psLoop{10}{%
\begin{pspicture}(-2,-2)(2,2)
\def\points{}% empty for each iteration
\multido{\i=0+1}{\Xnodecount}{\xdef\points{\points (X\i)}}
\expandafter\psccurve\points
\end{pspicture}}
\end{document}

• Compact:

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot}
\pstVerb{realtime srand}
\psset{plotpoints=50}

\begin{document}
\psLoop{10}{%
\begin{pspicture}(-2,-2)(2,2)
\psnccurve(0,\Xnodecount){X}
\end{pspicture}}
\end{document}


## Notes

\psnline, \psncurve, and \psnccurve are available but \psnpolygon is not.

## Attention

Note that Rand no longer produces a random real number between 0 and 0.5 inclusive. Its definition had been tacitly changed. Now it produces a random real number between 0 and 1 inclusive. It is not documented, nor announced, but it is still fun!

The code given above has not been updated yet so it will produce different output. I have no time to update it right now. Sorry for this inconvenience.

-
I think you misunderstand my means. I still hope the second answer's function. But still thanks a lot!! –  Felix Chang Aug 1 '13 at 17:52
@facebook-703000782: I still don't understand your question even though I have read it multiple times. My answer was created based on the output given by other answers. –  Oh my ghost Aug 1 '13 at 22:32

You can use plot:

  \documentclass{scrbook}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw  plot[smooth, tension=.7] coordinates {(-3.5,0.5) (-3,2.5) (-1,3.5) (1.5,3) (4,3.5) (5,2.5) (5,0.5) (2.5,-2) (0,-0.5) (-3,-2) (-3.5,0.5)};
\end{tikzpicture}

\begin{tikzpicture}
\draw  plot[smooth, tension=.8] coordinates {(-2.5,-0.5) (-3.5,0) (-2.5,0.5) (-3,1) (-2,1.5) (-2,3) (-1,2.5) (1,4.5) (2.5,3) (3,3.5) (3.5,3) (3,2) (4.5,2) (4.5,0) (3,1) (2.5,-0.5) (3.5,-1.5) (1.5,-1) (0.5,-2) (-2,-2.5) (-1.5,-1) (-2.5,-1.5) (-2.5,-0.5)};
\end{tikzpicture}
\end{document}


Using the same points as above the curve can be drawn using the excellent hobby package:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}[use Hobby shortcut,closed=true]
\draw (-3.5,0.5) .. (-3,2.5) .. (-1,3.5).. (1.5,3).. (4,3.5).. (5,2.5).. (5,0.5) ..(2.5,-2).. (0,-0.5).. (-3,-2).. (-3.5,0.5);
\end{tikzpicture}

\begin{tikzpicture}[use Hobby shortcut,closed=true]
\draw (-2.5,-0.5).. (-3.5,0).. (-2.5,0.5).. (-3,1).. (-2,1.5).. (-2,3).. (-1,2.5).. (1,4.5).. (2.5,3).. (3,3.5).. (3.5,3).. (3,2).. (4.5,2).. (4.5,0).. (3,1).. (2.5,-0.5).. (3.5,-1.5).. (1.5,-1).. (0.5,-2).. (-2,-2.5).. (-1.5,-1).. (-2.5,-1.5).. (-2.5,-0.5);
\end{tikzpicture}
\end{document}


Choose points as you wish and leave the rest to hobby. For more details, use texdoc hobby or texdoc.net.

-
Nice :-) Where is the hobby library documented? –  Tobi Jul 31 '13 at 10:10
@Tobi texdoc hobby :) –  cgnieder Jul 31 '13 at 10:15
Thank. I thought TikZ libraries can’T be found via texdoc and are documented as part of the pgfmanual. Btw. hobby seems to be not yet listed in tex.stackexchange.com/q/42611/4918 –  Tobi Jul 31 '13 at 10:28
@Tobi hobby is not an official part of pgf, i.e., it is not in tex/generic/pgf/libraries/ or tex/generic/pgf/frontendlayer/tikz/libraries/ but is distributed as a package of its own (in tex/latex/hobby/). –  cgnieder Jul 31 '13 at 10:37

Using the rand function, you can write the \irregularcircle macro:

\documentclass[tikz]{standalone}

\pgfextra {\pgfmathsetmacro\len{(#1)+rand*(#2)}}
+(0:\len pt)
\foreach \a in {10,20,...,350}{
\pgfextra {\pgfmathsetmacro\len{(#1)+rand*(#2)}}
-- +(\a:\len pt)
} -- cycle
}

\begin{document}
\begin{tikzpicture}
\coordinate (c) at (0,0);
\coordinate (d) at (1,2);
\draw[blue,rounded corners=1mm] (c) \irregularcircle{1cm}{1mm};
\draw[red,rounded corners=1mm] (d) \irregularcircle{1cm}{1mm};
\end{tikzpicture}
\end{document}


Edit: a variant using let operations (from the calc library):

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
let \n1 = {(#1)+rand*(#2)} in
+(0:\n1)
\foreach \a in {10,20,...,350}{
let \n1 = {(#1)+rand*(#2)} in
-- +(\a:\n1)
} -- cycle
}

\begin{document}
\begin{tikzpicture}
\coordinate (c) at (0,0);
\coordinate (d) at (1,2);
\draw[blue,rounded corners=.5mm] (c) \irregularcircle{1cm}{1mm};
\draw[red,rounded corners=.5mm] (d) \irregularcircle{1cm}{1mm};
\end{tikzpicture}
\end{document}

-
Paul, your answer is exactly I want. THX a lot!!! –  Felix Chang Jul 31 '13 at 10:47