5

When I draw arches using arc in pgf, the arch path precisely fits on the path of the corresponding (ie having the same radius) circle (red on black in the attached figure). When I apply shorten to the arc path, it does not fit, becomes distorted (blue line vs black/red). Is this normal or only a bug? Expecting a shortened arc path which fits precisely on the circle path is not correct? If this is not a bug, how can it be explained?

enter image description here

Latex code of the drawing:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\coordinate (C) at (4,4);
\draw[line width=2pt] (C) circle (4cm);
\draw[very thick,red] (C) ++(170:4cm) arc (170:60:4cm);
\draw[very thick,blue,shorten <=20pt,shorten >=20pt] (C) ++(170:4cm) arc (170:60:4cm);
\end{tikzpicture}
\end{document}
  • 1
    This is probably caused by the control points used, it looks to me like the end points are still at the original angle, which of course is wrong for a shorter arc. This is because (I guess) tikz applies a linear scaling of the coordinates of the endpoints (apparently not of the control points) instead of radially cutting of a part. Not sure how to fix this, perhaps you could apply a clip to the arc instead? – hugovdberg Apr 3 '14 at 18:31
3
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[yellow!80!black,ultra thick,-latex] (90:4cm)--+(-5mm,0)--+(45mm,0);
\foreach\x[evaluate=\x as \xi using 2.5*\x] in {0,4,...,40}
\draw[blue!\xi!red,shorten >=\x mm] (0,0)++(0:4cm) arc (0:90:4cm);
\end{tikzpicture}

\begin{tikzpicture}
\node[text width=2.6cm,above] (a) {A curve ending with a tangent angle opposite of green line};
\draw[latex-,thick] (0,0) arc (70:20:4cm);
\draw[thick,green,-latex] (0,0) -- ++(160:-2.5cm) 
          node[align=right,right] {shortening\\direction};

% Shortens
\draw[blue!10,shorten <=50pt] (0,0) arc (70:20:4cm);
\draw[blue!10,shorten <=70pt] (0,0) arc (70:20:4cm);
% Negative shortening means extension
\draw[red!10,thin,shorten <=-30pt] (0,0) arc (70:20:4cm);
\end{tikzpicture}
\end{document}

enter image description here

enter image description here

  • An artificial rainbow with limited colors? ;) – user11232 Apr 4 '14 at 0:11
  • @percusse---So you're demonstrating the longer the path shortened by, the more distorted it is, even going to the extreme. But what is your conclusion? – bcsikos Apr 4 '14 at 8:24
  • @percusse "shortens the path based on the final angle going backwards": I cannot comprehend this unfortunately, especially "final angle going backwards" I don't understand. – bcsikos Apr 4 '14 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.