[Tex/LaTex] Arrows from cloud cross the outer line

arrowstikz-pgf

I'm using TikZ to draw a cloud. Also I'm drawing arrows from the cloud to some nodes.
But the startpoints of the arrows are in or outside the cloud but not exactly on the outer line.
I think the picture shows my problem:

a cloud with arrows

As well here is an MWE:

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
    \node[cloud, cloud puffs=15.7, minimum width=3cm, draw] (cloud) at (0,0) {Cloud};
    \path[->] (cloud) edge (2, 2)
          (cloud) edge (2, 1);
\end{tikzpicture}
\end{document}

As you may think by yourself my question is how to position the start points of the arrows on the line of the cloud.

Best Answer

You can either use an integer number of puffs or the intersections library and find the points manually.

Notes:

  • I used named coordinates for (2,1) and (2,2) to not repeat hard-coded coordinates.
  • The anchor .center is neede because in the second example (the one to (2,1)) the (cloud) -- (2,1) does not intersect with the cloud’s border.

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{shapes,intersections}
\begin{document}
\begin{tikzpicture}
    \node[
        name path=cloud,
        cloud, cloud puffs=15.7,
        minimum width=3cm, draw,
    ] (cloud) at (0,0) {Cloud};
    \path[name path=path22] (cloud.center) -- (2, 2) coordinate (to22);
    \path[name path=path21] (cloud.center) -- (2, 1) coordinate (to21);
    \draw[->,
          name intersections={of=cloud and path22,name=from22},
          name intersections={of=cloud and path21,name=from21}
       ] (from22-1) edge (to22)
         (from21-1) to   (to21);
\end{tikzpicture}
\end{document}

Output

enter image description here