# **Why** does cycle not return to the starting node **at all** if I construct a path between predefined nodes, rather than coordinates, in TikZ?

cycle doesn't work as I would naïvely expect it to if I use the node operation rather than coordinate to mark my points. I realise that, in the case of a node, TikZ is drawing to and from the borders of the nodes. So I can understand that the triangle is not filled because TikZ might regard the path as a non-closed one. (Although in other cases, it will actually finish a path in order to fill it as requested.) But why is the final size of the triangle not even drawn?

\documentclass[tikz,border=10pt,multi]{standalone}
\begin{document}
\begin{tikzpicture}[every node/.append style={draw}]
\node (a)  at (-1,1) {};
\node (c)  at (-1,-1) {};
\node (f)  at (1,1) {};
\filldraw (a) -- (c) -- (f) -- cycle;
\end{tikzpicture}
\end{document}


pmav99 asked this question in 2011. However, the answers there do not obviously explain to me why nothing is drawn at all. I could understand if the final line returned to the border anchor of (a) from which the path began. I could also understand if it returned to the border anchor of (a) which it would use if I wrote -- (a) rather than -- cycle. But why does it not appear to go anywhere? (Or where does it go, if it goes somewhere, and why?)

I'm sure this must be a duplicate, but I can't find an explanation of this specific aspect of what TikZ is doing.

Also, I of course know that \coordinate (a) ... etc. would make more sense here, that I could define the points while constructing the path etc. I know how to avoid the problem. What I want to understand is the precise whys of why that problem occurs in the particular form it does. What exactly is -- cycle doing in this case?

Because each of them are separate paths from each node shape border to the other.

The final construction is equivalent to (using convenience of their locations)

\filldraw (a.-90) -- (c.90) % pen is lifted here hence a new path starts
(c.45) -- (f.-135) -- cycle;


Hence cycle goes back to (c.45) as it is the starting point of the unbroken path redrawing the last portion of the path creating a zero area.

Put anything that is not collinear between (c) and (f) and you get a fill

\filldraw (a) -- (c) -- (1,-1) --(f) -- cycle;


Coordinates on the other hand have no border shapes but only a center anchor hence they constitute as valid path points thus cycle goes back to a since that is the first point of the continuous path.

• Nitpick: But it is one whole path, not separate ones. But yes, a move to operation happens. And the PGFmanual says: “This causes the straight line from the current point to go to the last point specified by a move-to operation.” – Qrrbrbirlbel Jun 19 '16 at 10:52
• @Qrrbrbirlbel Yes probably I should have said pen down instead unbroken since it is a PDF operation. – percusse Jun 19 '16 at 11:14