箭头缩放问题。如何正确缩放绘图中的极小部分?

箭头缩放问题。如何正确缩放绘图中的极小部分?

谢谢此解决方案,我可以绘制路径的切线。我想放大绘图的一小部分。

代码如下:

\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]

我遇到的问题是箭头缩放。图片上怎么看,效果不太好。

有人能解释一下如何扩展吗仅有的线宽和箭头是否正确?

通过变换画布,我获得了总缩放比例,但这并不好,因为它会平移线条。

答案1

我添加了以下代码来解决我的问题

\begin{tikzpicture}
\makeatletter
\newdimen\arrow@size
\tikzset{arrow size/.code       = {\arrow@size=#1},
         arrow theta/.code      = \def\arrow@theta{#1},
         fd style/.style 2 args = {arrow size=#1,arrow theta = #2}}

\pgfarrowsdeclare{fd}{fd}{
\pgfarrowsleftextend{0pt}
\pgfarrowsrightextend{.5\pgflinewidth}
}
{
\pgfmathsetlengthmacro{\arrow@theta}{\arrow@size*tan(\arrow@theta)}
\pgfsetdash{}{0pt} % do not dash
\pgfsetroundjoin % fix join
\pgfsetroundcap % fix cap
%\pgfsetstrokecolor{red}
\pgfpathmoveto{\pgfpointorigin}%{\pgfpoint{-4\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfpoint{-\arrow@size}{\arrow@theta}}
\pgfpathmoveto{\pgfpointorigin}%{\pgfpoint{-4\arrowsize}{4\arrowsize}}
\pgfpathlineto{\pgfpoint{-\arrow@size}{-\arrow@theta}}
\pgfusepathqstroke
}
\makeatother




\draw[help lines] (-3,0)grid(3,15);

\foreach[count=\n] \lw/\l/\ang in {1pt/3pt/10,
                                   2pt/6pt/35,
                                   5pt/12pt/45,
                                   7pt/1cm/70}{
\draw[line width=\lw,fd-fd,fd style={\l}{\ang}](-2,3*\n)--(2,3*\n);}
\end{tikzpicture}

结果如下

在此处输入图片描述

如果您知道更好的解决方案,请告诉我。

相关内容