I have an image where I'd like to draw arrows between nodes where the arrows are all "on the same circle". I can achieve what I want by hand as follows:


\begin{tikzpicture}[ultra thick, -stealth]
  \node[circle,fill] (a) at (0: 1) {};
  \node[rectangle,minimum width=1cm,fill](b) at (120: 1) {};
  \node[rectangle,minimum height=1cm,fill](c) at (240: 1) {};
  \draw[dashed] (85: 1) arc (85: 30: 1) ;
  \draw (330:1) arc (330: 280:1) ;
  \draw[dashed] (200:1) arc (200: 140:1);

But if my nodes are different shapes and sizes, I have to find coordinates that work by hand. What I'd really like to do, is find where the edges of the node intersect the circle and draw the arcs using those edges. Is there an automatic way to do this? This answer is a partial solution, but it seems like I'd still have to pick the arcs and shorten lengths by hand...

The actual use case is that the nodes will contain pictures of different aspect ratios. I've approximated the problem using some akward shaped nodes.

  • 2
    Could you modify your code, so that the nodes has "different shapes and sizes"? -it would make it a lot easier to test a solution. Commented Aug 28, 2020 at 11:16
  • 2
    In your code, the nodes are equidistant and form an equilateral triangle. Does this always have to be the case?
    – AndréC
    Commented Aug 28, 2020 at 11:18
  • @AndréC no. I'm interested in a general solution. But they'll always be given by polar coordinates at the same radius.
    – Seamus
    Commented Aug 28, 2020 at 13:31
  • @hpekristiansen that's a good idea, I'll do that next time I'm at my desk.
    – Seamus
    Commented Aug 28, 2020 at 13:33
  • As I know, it is impossible to do such thing automatically with different shapes because there is no common way to calculate the intersection of the shape border and the arc path.
    – ZhiyuanLck
    Commented Aug 28, 2020 at 16:56

1 Answer 1


Heiko Oberdiek rules!!!! --


enter image description here



    main node/.style={circle, fill=blue!20, draw},
    % Print main nodes, node names: p1, p2, ...
    (0, 0) coordinate (M)
    \foreach \t [count=\i] in {A, Hello\\World, 3, foobar, $\cdot$} {
        +({\i-1)*360/\MainNum + \MainStartAngle}:\MainRadius)
        node[main node, align=center] (p\i) {\t}
    % Calculate the angle between the equal sides of the triangle
    % with side length \MainRadius, \MainRadius and radius of circle node
    % Result is stored in \p1-angle, \p2-angle, ...
    \foreach \i in {1, ..., \MainNum} {
        \pgfextracty{\dimen0 }{\pgfpointanchor{p\i}{north}} 
        \pgfextracty{\dimen2 }{\pgfpointanchor{p\i}{center}}
        \dimen0=\dimexpr\dimen2 - \dimen0\relax 
        \ifdim\dimen0<0pt \dimen0 = -\dimen0 \fi
        \global\expandafter\let\csname p\i-angle\endcsname\pgfmathresult
    % Draw the arrow arcs
    \foreach \i [evaluate=\i as \nexti using {int(mod(\i, \MainNum)+1}]
    in {1, ..., \MainNum} {  
            (\i-1)*360/\MainNum + \MainStartAngle
            + \csname p\i-angle\endcsname
            (\nexti-1)*360/\MainNum + \MainStartAngle
            - \csname p\nexti-angle\endcsname
        \ifdim\EndAngle pt < \StartAngle pt
        \pgfmathsetmacro\EndAngle{\EndAngle + 360}
        (M) ++(\StartAngle:\MainRadius)
        arc[start angle=\StartAngle, end angle=\EndAngle, radius=\MainRadius]
  • 1
    OP wants nodes with different shapes.
    – ZhiyuanLck
    Commented Aug 28, 2020 at 16:57
  • I suspect this solution won't work for my case, since the calculations can't be automated in the way they are here.
    – Seamus
    Commented Aug 29, 2020 at 15:09
  • 1
    What is your contribution to this code? If nothing substantial it's more appropriate to add comment linking the the original answer.
    – Alan Munn
    Commented Aug 29, 2020 at 17:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .