I have a curved path that I want to put an open diamond arrow tip on. Here is a MWE with my best attempt:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}[decoration={
markings,
mark=at position .5 with {\arrow[>=open diamond] {>} } }
]
\node (0) {};
\node (1) [right of=0] {};
\node (2) [below right of=1] {};
\path (0) edge[out=0, in=135, postaction={decorate}] (2);
\end{tikzpicture}
\end{document}
As you can see, the bottom-right point of the diamond is perfectly on the path, but the top-left point is clearly above the path. It appears that the diamond lies on the tangent line of the path at the bottom-right point of the diamond.
Question:
How can I place this open diamond arrow tip so that both points of the diamond are on the path?
Bonus Question:
What is the best solution to make the area inside the diamond completely white? I don't want to see the path in the inside of the diamond. I currently have a solution that I feel is a hack, which is to place a white (closed) diamond arrow tip in the same spot first:
mark=at position .5 with {\arrow[>=diamond, white] {>} },
Best Answer
Here's a very over the top approach that places a coordinate at a specified location along the path, places a circle with a specified diameter on that coordinate, calculates the intersections of the curve and the circle, and then draws a diamond between the two intersections.
Drawbacks: The diamonds will have slightly different sizes, depending on the curvature of the original path. The original path isn't interrupted, instead the diamonds are just drawn on top. With the current implementation, while you can have several diamonds on the same path, the options like
diamond ratio
,diamond length
, andevery diamond
will apply to all diamonds equally.