[Tex/LaTex] TikZ: How to decorate a path with the open diamond arrow tip that “bends” with the path

arrowsdecorationspathstikz-pgf

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}

open diamond on curved path

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, and every diamond will apply to all diamonds equally.

\documentclass{standalone}
\usepackage{tikz}

\tikzset{
    diamond helpers/.code={
        \path [draw,name path=circle] (middle) circle [radius=0.1cm];
    },
    diamond/.style={
        decoration={
            markings,
            mark=at position #1 with {
                \coordinate (middle);
                \path [name path=circle] (middle) circle [radius=0.5*\diamondlength];
                \draw [every diamond, name intersections={of=curve and circle}]
                    (intersection-1) -- 
                    ($($(intersection-1)!0.5!(intersection-2)$)!\diamondaspect!90:(intersection-2)$) -- 
                    (intersection-2) -- 
                    ($($(intersection-1)!0.5!(intersection-2)$)!\diamondaspect!-90:(intersection-2)$) -- 
                    cycle;}
        },
        postaction=decorate,
        name path global=curve
    },
    diamond/.default=0.5,
    diamond aspect/.store in=\diamondaspect,
    diamond aspect=0.75,
    diamond length/.store in=\diamondlength,
    diamond length=0.2cm,
    every diamond/.style={draw,fill=white}
}


\usetikzlibrary{decorations.markings,intersections,calc}
\begin{document}
 \begin{tikzpicture}
*  \draw [diamond, diamond=0.1] (0,0) to [out=70, in=100] (1,-1);  
 \end{tikzpicture}
\end{document}