[Tex/LaTex] Draw a chain of beads

asymptotediagramspstrickstikz-pgf

I would like to reproduce this kind of figure:

enter image description here

I'm wondering what's the best way to achieve that with TikZ.

My guess is to draw an element composed of a circle + a link and to link this element by specifying only an angle (since the distance is always the same).

Any suggestions?

Best Answer

A very simple proof of concept example:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw[fill] (0,0) circle (.5) -- ++(10:2) circle (.5) -- ++(-20:2) circle (.5);
\end{tikzpicture}
\end{document}

enter image description here

Of course one could do some very nice tweaks such as building an own style for the lines and circles, but the code above contains at least everything that is needed to reach your goal.

Depending on what you need exactly, it was also very easily possible to automate the generation of such a chain including for example random angles between the beads.

Here's a version using a \foreach to specify a list of angles:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\tikzset{bead/.style={circle,fill=black,inner sep=3pt}}

\draw node[bead] {} (0,0)
\foreach \angle in {10,40,50,-50,0,150,30,-60,45,45,0}
  { -- ++(\angle:1) node[bead] {}};
\end{tikzpicture}

\end{document}

enter image description here

And a version with relative angles (Qrrbrbirlbel suggested this version in chat and I like it more than the one I initially had):

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\tikzset{bead/.style={circle,fill=black,inner sep=3pt}}
\def\angle{0}

\draw node[bead] {} (0,0)
\foreach \stepangle[evaluate=\stepangle as \angle using \angle+\stepangle, remember=\angle] in {10,20,-30,-60,135,-20,-30,0}
  { -- ++(\angle:1) node[bead]{}};
\end{tikzpicture}

\end{document}

enter image description here