# Drawing arrows indicating path's length in TikZ [duplicate]

I want to redraw this image using TikZ:

I've written this code so far:

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


It yields this image:

As you can see, tthe indicator for the angle γ is missing.

To keep things tidy I am looking the an answer to another question:

How can I draw the arrows above the two lines reading vT and r?

(Answers to the other missing feature are also welcome...)

• Did you read Draw dimension of a line as a decoration in TikZ? – Paul Gaborit Nov 12 '13 at 23:40
• The question is very similar indeed. None of the answers there mentions the midway and fill=white options like in mrc's answer, though. "Close" just means the no new answers can be added but everything written so far is preserved? – frankundfrei Nov 13 '13 at 0:08
• @frankundfrei Do you want new answers? If so, may you tell why? Is there any difficulty further? – user11232 Nov 13 '13 at 0:26
• The midway option is equivalent to the pos=.5 option. – Paul Gaborit Nov 13 '13 at 0:27
• Thanks Werner, that was what I was concerned about. Marking as duplicate is probably the best way to go. – frankundfrei Nov 13 '13 at 0:40

I would use the <-> arrow style (|-| is also nice), with a midway, fill=white node for the label:

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


With 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}