在 TikZ 中绘制指示路径长度的箭头

在 TikZ 中绘制指示路径长度的箭头

我想使用 TikZ 重新绘制此图像: 在此处输入图片描述

到目前为止我已经写了这段代码:

\documentclass[tikz]{standalone}

\usetikzlibrary{intersections}
\tikzset{help lines/.style={dashed, thick}}

\begin{document}
\begin{tikzpicture}[scale=3]
\clip (-2,-1.5) rectangle (1.5,1.5);

  % draw x axis and small ticks at centers of circles
  \draw[name path={xaxis}] (-2,0) -- (2,0);
  \draw (-1.5,0.05) -- (-1.5,-0.05);
  \draw (0,0.05) -- (0,-0.05);

  % set coordinate of center of big circle
  \coordinate (centerbig) at (-1.5,0);

  % draw small circle and invisible big circle
  \draw[name path={small circle}] (0,0) circle (1);
  \draw[style=transparent,name path={big circle}] (-1.5,0) circle (2) {}; % just to get name for bigcircle

  % calculate and name intersections of both circles and big circle with x axis
  \draw [name intersections={of=small circle and big circle, by={first intersect, second intersect}}];
  \draw[name intersections={of=big circle and xaxis, by={middle intersect}}];

  % draw help lines of big circle
  \draw[style=help lines] (middle intersect) arc (0:35:2);
  \draw[style=help lines] (middle intersect) arc (0:-35:2);

  % draw radius lines of big circle
  \draw (centerbig) -- +(20:2);
  \draw (centerbig) -- (second intersect);

    % indicatior for diameter of small circle
   \draw[thick,style = ->] (135:1.3) -- (135:1);
   \draw[thick,style = ->] (-45:1.3) node[above right] {\(2 D\)} -- (-45:1);

  % draw the section of big circle inside the small circle
  \pgfsetlinewidth{1.5pt}
  \pgfsetstrokecolor{black}
  \pgfpathmoveto{\pgfpointanchor{first intersect}{south}}
  \pgfpatharcto{2cm}{2cm}{1}{0}{0}{\pgfpointanchor{second intersect}{south}}
  \pgfusepath{stroke}
\end{tikzpicture}
\end{document}  

得到如下图像:

在此处输入图片描述

如您所见,缺少角度 γ 的指示器。

为了保持整洁,我正在寻找另一个问题的答案:

我怎样才能在写着 vT 和 r 的两条线上方画出箭头?

(也欢迎回答其他缺失的功能……)

答案1

我将使用<->箭头样式(|-|也很好),并使用midway, fill=white节点作为标签:

\documentclass[tikz]{standalone}

\usetikzlibrary{intersections}
\tikzset{help lines/.style={dashed, thick}}

\begin{document}
\begin{tikzpicture}[scale=3]
\clip (-2,-1.5) rectangle (1.5,1.5);

  % draw x axis and small ticks at centers of circles
  \draw[name path={xaxis}] (-2,0) -- (2,0);
  \draw (-1.5,0.05) -- (-1.5,-0.05);
  \draw (0,0.05) -- (0,-0.05);
  \draw[<->] (-1.5,0.15) -- (0,0.15) node[midway, fill=white] {$r$};

  % set coordinate of center of big circle
  \coordinate (centerbig) at (-1.5,0);

  % draw small circle and invisible big circle
  \draw[name path={small circle}] (0,0) circle (1);
  \draw[style=transparent,name path={big circle}] (-1.5,0) circle (2) {}; % just to get name for bigcircle

  % calculate and name intersections of both circles and big circle with x axis
  \draw [name intersections={of=small circle and big circle, by={first intersect, second intersect}}];
  \draw[name intersections={of=big circle and xaxis, by={middle intersect}}];

  % draw help lines of big circle
  \draw[style=help lines] (middle intersect) arc (0:35:2);
  \draw[style=help lines] (middle intersect) arc (0:-35:2);

  % draw radius lines of big circle
  \draw (centerbig) -- +(20:2);
  \draw[<->] (centerbig) ++(110:0.15) -- +(20:2) node[midway,fill=white] {$v_{\hat{T}}$};
  \draw (centerbig) -- (second intersect);

    % indicatior for diameter of small circle
   \draw[thick,style = ->] (135:1.3) -- (135:1);
   \draw[thick,style = ->] (-45:1.3) node[above right] {\(2 D\)} -- (-45:1);

  % draw the section of big circle inside the small circle
  \pgfsetlinewidth{1.5pt}
  \pgfsetstrokecolor{black}
  \pgfpathmoveto{\pgfpointanchor{first intersect}{south}}
  \pgfpatharcto{2cm}{2cm}{1}{0}{0}{\pgfpointanchor{second intersect}{south}}
  \pgfusepath{stroke}
\end{tikzpicture}
\end{document}  

在此处输入图片描述

答案2

使用 PSTricks。

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-eucl}
\psset{PointName=none,PointSymbol=none}
\begin{document}
\begin{pspicture}(-6,-4)(4,4)
    \pstGeonode{O}(-5,0){A}(-3,0){B}(1,0){C}(3;135){D}(3;-45){E}([nodesep=6,angle=20]{C}A){S}
    \pcline[nodesepA=-1,nodesepB=-4](A)(O)
    \pstInterCC{O}{B}{A}{C}{P}{Q}
    \pstArcOAB[arcsep=-2,linestyle=dashed]{A}{P}{Q}
    \pstArcOAB[linewidth=3\pslinewidth]{A}{P}{Q}
    \pcline{<-}(D)([nodesep=-1]{O}D)
    \pcline{<-}(E)([nodesep=-1]{O}E)
    \uput[r]([nodesep=-1]{O}E){$2D$}
    \pcline([offset=.2]O)([offset=-.2]O)
    \pcline([offset=.2]A)([offset=-.2]A)
    \pcline[offset=-.3]{<->}(A)(O)\ncput*{$r$}
    \pcline[offset=.3]{<->}(A)(S)\ncput*{$v_{\vec{T}}$}
    \pstCircleOA{O}{B}
    \pcline(A)(S)
\end{pspicture}
\end{document}

在此处输入图片描述

相关内容