Thanks to this solution, I can draw tangent line to a path. I'd like to zoom a very little part of my drawing.
Here it is the code:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,arrows,spy,decorations.markings,decorations.text}
\tikzset{tangent/.style={decoration={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
}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}[>=angle 45,
spy scope = {connect spies,
every spy on node/.style = {circle,draw},
every spy in node/.style = {circle,draw},
magnification = 15}]
% Terrain parameters
\def\SoilWidth{7.75}
\pgfmathsetmacro{\MaxDepPos}{.3*\SoilWidth}
\pgfmathsetmacro{\ErDepth}{5/19}
\pgfmathsetmacro{\cdI}{.07*\SoilWidth}
\pgfmathsetmacro{\cdII}{.8*\MaxDepPos}
\pgfmathsetmacro{\cdIII}{.5*\SoilWidth}
\pgfmathsetmacro{\cdIV}{.2*\SoilWidth}
%%%%%%%%
% DRAW %
%%%%%%%%
\coordinate[label=O] (O) at (0,0);
%-> Terrain points
\coordinate (S1) at ($(O)+(\MaxDepPos,-\ErDepth)$);
\coordinate (S2) at ($(O)+(\SoilWidth,0)$);
%-> Terrain control points
\coordinate (SC1) at ($(O)+(\cdI,0)$);
\coordinate (SC2) at ($(S1)+(-\cdII,0)$);
\coordinate (SC3) at ($(S1)+(\cdIII,0)$);
\coordinate (SC4) at ($(S2)+(-\cdIV,0)$);
\draw[densely dashed] (O)--(S2);
%-> Erosion depth
\draw[tangent=0.1] (O) ..controls (SC1) and
(SC2)..(S1)..controls (SC3) and
(SC4)..(S2);
%%%% PROBLEM HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\LineScale{.2} %
\draw[use tangent, %
orange, %
line width= \LineScale*.4pt, %
->] (0,0)--(.1,0) %
(0,0)coordinate(SlopedPoint) %
(0,-.1) -- (0,.1); %
%
\coordinate (SlopedPoint1) at (SlopedPoint|-O); %
%
\draw[line width = \LineScale*.4pt, %
decoration = {markings, %
mark=at position 0 with {\arrowreversed[scale=\LineScale]{>}};, %
mark=at position 1 with {\arrow[scale=\LineScale]{>}};}, %
postaction = {decorate}](SlopedPoint1)--(SlopedPoint); %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\spy [red,
height = 4cm,
width = 4cm] on ($(SlopedPoint1)!.57!(SlopedPoint)$) in node at (6,3);
\node[left,
scale = .1] at($(SlopedPoint1)!.5!(SlopedPoint)$){$\delta$};
\end{tikzpicture}
\end{document}][1]
The problem I encounter is the arrow scaling. How it can be seen on the picture, the result is not so good.
Can somebody explain me how to scale only the line width and the arrows in a proper way?
With transformation canvas I obtain a total scaling, and it is not ok because it translate the lines.
