## #238 Incorrect behavior for "open triangle" arrow tips

v1.0 (example)
closed-wont-fix
nobody
None
5
2013-07-16
2013-03-25
Anonymous
No

The code below (which creates the attached pictures) contains two identical TikZ pictures in terms of the LaTeX code except that the first uses the "triangle 60" tip while the section uses the "open triangle 60" tip. The expected behavior is that the pictures would be identical except for the different arrow tip. Instead, the curve of the edge is different because the location of the second control point in the Bézier curve [http://en.wikipedia.org/wiki/B%C3%A9zier_curve] is different. More specifically, when using the "triangle 60" tip, the tangent line of the curve is vertical at the point the arrow tip and node touch. When using the "open triangle 60" tip, the tangent line of the curve is vertical at the point the curve touches the arrow tip.

These two arrow tips have exactly the same shape. The only difference is the shading. Thus, the expected behavior is that they would have the same affect on the Bézier curve.

Code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\tikzstyle{closed} = [draw, fill, shape=circle]
\begin{tikzpicture}[scale=2, transform shape, >=triangle 60]
\node[draw, fill, shape=circle] (n0) {};
\node[draw, fill, shape=circle] (n1) [right of=n0] {};
\fill (n0) edge [->, out=90, in= 90, looseness=2] (n1);
\begin{scope}[on background layer]
\fill[fill=black!20] (n0.90) to [out=90, in=90, looseness=2] (n1.90) to (n0.90);
\end{scope}
\end{tikzpicture}
\begin{tikzpicture}[scale=2, transform shape, >=open triangle 60]
\node[draw, fill, shape=circle] (n0) {};
\node[draw, fill, shape=circle] (n1) [right of=n0] {};
\fill (n0) edge [->, out=90, in= 90, looseness=2] (n1);
\begin{scope}[on background layer]
\fill[fill=black!20] (n0.90) to [out=90, in=90, looseness=2] (n1.90) to (n0.90);
\end{scope}
\end{tikzpicture}
\end{document}

## Discussion

• Comment has been marked as spam.
Undo

You can see all pending comments posted by this user  here

Anonymous - 2013-03-26

All these open arrow tips behave different than their closed counterparts

• Comment has been marked as spam.
Undo

You can see all pending comments posted by this user  here

Anonymous - 2013-03-26
• summary: Incorrect behavior when using the "open triangle" arrow tip --> Incorrect behavior for "open triangle" arrow tips

• Comment has been marked as spam.
Undo

You can see all pending comments posted by this user  here

Anonymous - 2013-03-26

All there "open triangle" arrow tips have this problem (see attached image). The above code compares just the 'triangle 60" and its closed counterpart.

• Comment has been marked as spam.
Undo

You can see all pending comments posted by this user  here

Anonymous - 2013-03-26

A workaround for "open triangle 60" is provided in this Tex - StackExchange answer by defining a new arrow tip that looks like "open triangle 60" but behaves like "triangle 60":
http://tex.stackexchange.com/questions/104164/color-the-faces-of-a-graph/104169#104169

Last edit: Anonymous 2014-05-05
• Luigi - 2013-03-26

You are right. They look different because in the open arrows the shaft doesn't protrude into the arrow head which is transparent. Do you think this is a wrong behaviour? I'm interested in your opinion because in the unofficial arrows.new library (in the feature request section) all the triangle arrows have the same behaviour of the open ones.
Try the triangle 60 arrow with line width=5pt. Does the junction between shaft and head seem odd? Doesn't it? And now try with opacity=0.5. As you can see, there is an incorrect behaviour too, but in your example the small size of the head hid it and let you believe it was good.
I think what you are asking for requires a change in the way the arrows are drawn, i.e. by shortening the line they are attached to.

• Till Tantau - 2013-07-16
• status: open --> closed-rejected
• Group: --> v1.0 (example)

• Till Tantau - 2013-07-16

Hi,

sorry, this won't fix, but it needs some explanation...

When TikZ draws a "large" arrow tip as in the example, it will "shorten" the path a bit (in this case, the Bezier curve). This shortening is done by pushing back along a straight line from the end of the path in the direction of a tangent to the path at that point (so along the line from the last support point of the last Bezier curve to the end point). The support points stay the same, however. In particular, for a Bezier curve, the "shortened" path is no longer identical to the original one; rather, it is a bit off.

One might argue that the path should be shortened "along" the Bezier curve itself rather than along a straight line that is tangent to the end of the curve. However, that is "simply too tough to compute": It is certainly more or less impossible to do in TeX itself and even with Lua support it is mathematically quite challenging. Anyway, TikZ does and will always shorten the line along a straight line.

Now, why do the two arrow tips look different? The reason is that TikZ tries to be smart: We want to push back the path as little as possible since, as we saw above, causes curve path to deviate from the correct path. For a closed triangle we only need to push back the path very little: Just enough so that a line ending with a "rectangular cap" inside the triangle is not seen at the tip of the triangle. For the open triangle, the situation is quite different: The path needs to be push back all the way back to the side of the triangle that is perpendicular to the path (as can be seen in the example).

Thus, because for the open triangle we need to push back the path so far, the Bezier morphing is stronger that for the closed triangle (where it also happens, you just do not see it because the effect is so small).

Concerning a fix: Have your paths end in a sufficiently long straight line.

Best regards,
Till

• Till Tantau - 2013-07-16
• status: closed-rejected --> closed-wont-fix