I want to draw some lines in a tangent coordinate system of the decoration of a path. Especially I want to draw a tangent segment at the end of the decoration with full controll, i.e. with having the start end end points of the segment as coordinates.
I tried the following (adapted from an answer to How to draw tangent line of an arbitrary point on a path in TikZ):
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings,decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[tangent/.style={
decoration={
markings,% switch on markings
mark=
at position #1
with
{
\coordinate (tangent point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
\coordinate (tangent unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
\coordinate (tangent orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);
}
},
postaction=decorate
},
use tangent/.style={
shift=(tangent point-#1),
x=(tangent unit vector-#1),
y=(tangent orthogonal unit vector-#1)
},
use tangent/.default=1]
\draw[decorate,tangent=0,decoration={coil,amplitude=20,segment length=20,post length=0}] (0,0) coordinate (X) -- ++(5,5);
\node[below] at (X) {$x$};
%want a tangent line at (X) with start end end coordinates
\draw[use tangent] (0,0) -- ++(1,0);
\end{tikzpicture}
\end{document}
However I get an error:
ERROR: Package pgf Error: No shape named tangent unit vector-1 is known.
Output of the imcomplete picture:

Any idea how to make this work? I guess that there should be a more easy way to do it.

