I am studying the answer of @Caramdir to TikZ: draw only a certain central length of a given path

I would like the segment to be shifted orthogonally relative to the path. I am trying to insert raise somewhere in

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations}

% A simple empty decoration, that is used to ignore the last bit of the path
\pgfdeclaredecoration{ignore}{final}
{
\state{final}{}
}

% Declare the actual decoration.
\state{initial}[
next state=middle
]
{\decoration{moveto}}

\state{middle}[
width={\the\pgfdecorationsegmentlength},
next state=final
]
{\decoration{curveto}}

\state{final}
{\decoration{ignore}}
}

% Create a key for easy access to the decoration (as suggested by Jake).
\tikzset{middle segment/.style={decoration={middle},decorate, segment length=#1}}
\begin{document}
\fill (0,0) circle;
\fill (4,2) circle;
\draw[middle segment=2cm, double, red, ->] (0,0) to[bend right =20] (4,1);
\end{tikzpicture}
\end{document}


You could simply use the calc library to shift the path.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations,calc}

% A simple empty decoration, that is used to ignore the last bit of the path
\pgfdeclaredecoration{ignore}{final}
{
\state{final}{}
}

% Declare the actual decoration.
\state{initial}[
next state=middle
]
{\decoration{moveto}}

\state{middle}[
width={\the\pgfdecorationsegmentlength},
next state=final
]
{\decoration{curveto}}

\state{final}
{\decoration{ignore}}
}

% Create a key for easy access to the decoration (as suggested by Jake).
\tikzset{middle segment/.style={decoration={middle},decorate, segment length=#1}}
\begin{document}
\draw[middle segment=2cm, red, ->] ($(0,0)!1cm!90:(4,1)$) to[bend right =20]
($(4,1)!1cm!-90:(0,0)$);