3

I believe that this is a duplicate of a question/answer posted within the past two months. But, after much searching, I still can't find it. Does someone out there know the link?

My question

I'm not happy with the placement of the arrow in the following picture. Anyone know how to correct the angle at which the arrow is attached to the arc?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\begin{document}

\begin{tikzpicture}[x=0.5cm,y=0.5cm]
    \draw[help lines,blue!20,step=1] (0,0) grid (12,12);

    \draw[fill]  (0,0) coordinate [label=180:Z] (Z) circle (2pt);           %% center of the picture
    \draw[fill]  (5,5) coordinate [label=135:Q] (Q) circle (2pt);           %% center of the circle
    \draw[fill]  (Q) -- +(  0:6)   coordinate [label=0:A] (A) circle (2pt); %% first point on the circle
    %% drawing the circle
    \draw[blue]  (A) 
                 let \p1 = ($ (A) - (Q) $) in
                 arc(0:360:{veclen(\x1,\y1)});

    %% PROBLEMATIC LINES
    \draw [line width=0.4pt,red]
          let \p1 = ($(A) - (Q)$), \n1={veclen(\x1,\y1)} in
          (Q) -- +(320:\n1)
          coordinate (B) circle (2pt);




    \draw[purple,line width=0.4pt] 
          (B) -- +($  (0,0) ! 2em ! 0 : ($(B)-(Q)$)  $)  
          coordinate [label=center:B] (Bl) circle (6pt);

    \draw[blue]   
          ($ (B) ! 0.45 ! (Q) $) 
          coordinate (tC) circle (2pt);

    \draw[line width=1.5em,->]
          (tC) 
          let \p1 = ($(tC) - (Q)$) in
              arc ({atan2(\x1,\y1)}:{atan2(\x1,\y1)+90}:{veclen(\x1,\y1)});

\end{tikzpicture}

\end{document}

enter image description here

UPDATE

OK, the link was found at Create curved TikZ single arrow, but I'm still having difficulty getting it to work. Here's one example of what I've tried.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\begin{document}

\begin{tikzpicture}[x=0.5cm,y=0.5cm]
    \draw[help lines,blue!20,step=1] (0,0) grid (12,12);

    \draw[fill]  (0,0) coordinate [label=180:Z] (Z) circle (2pt);           %% center of the picture
    \draw[fill]  (5,5) coordinate [label=135:Q] (Q) circle (2pt);           %% center of the circle
    \draw[fill]  (Q) -- +(  0:6)   coordinate [label=0:A] (A) circle (2pt); %% first point on the circle
    %% drawing the circle
    \draw[blue]  (A) 
                 let \p1 = ($ (A) - (Q) $) in
                 arc(0:360:{veclen(\x1,\y1)});

    %% PROBLEMATIC LINES
    \draw [line width=0.4pt,red]
          let \p1 = ($(A) - (Q)$), \n1={veclen(\x1,\y1)} in
          (Q) -- +(320:\n1)
          coordinate (B) circle (2pt);

    \draw[purple,line width=0.4pt] 
          (B) -- +($  (0,0) ! 2em ! 0 : ($(B)-(Q)$)  $)  
          coordinate [label=center:B] (Bl) circle (6pt);

    \draw[blue]   
          ($ (B) ! 0.45 ! (Q) $) 
          coordinate (tC) circle (2pt);

    \draw[line width=01.5em,->,end angle=230]
          (tC) 
          let \p1 = ($(tC) - (Q)$), 
              \n1={atan2(\x1,\y1)}, %% start angle
              \n2={\n1+90},         %% end angle
              \n3={veclen(\x1,\y1)} %% radius
          in
              arc (\n1:\n2:\n3)
              -- ++(\n2+90:\n3)
          %    -- ++(\n2+0:\n3)
             ;

\end{tikzpicture}

\end{document}

But there's a bit more length to the arrow than I want.

A bit more hacking seems to get it

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\pagestyle{empty}
\setlength{\parindent}{0pt}
\begin{document}

\begin{tikzpicture}[x=0.5cm,y=0.5cm]
    \draw[help lines,blue!20,step=1] (0,0) grid (12,12);

    \draw[fill]  (0,0) coordinate [label=180:Z] (Z) circle (2pt);           %% center of the picture
    \draw[fill]  (5,5) coordinate [label=135:Q] (Q) circle (2pt);           %% center of the circle
    \draw[fill]  (Q) -- +(  0:6)   coordinate [label=0:A] (A) circle (2pt); %% first point on the circle
    %% drawing the circle
    \draw[blue]  (A) 
                 let \p1 = ($ (A) - (Q) $) in
                 arc(0:360:{veclen(\x1,\y1)});

    %% PROBLEMATIC LINES
    \draw [line width=0.4pt,red]
          let \p1 = ($(A) - (Q)$), \n1={veclen(\x1,\y1)} in
          (Q) -- +(320:\n1)
          coordinate (B) circle (2pt);

    \draw[purple,line width=0.4pt] 
          (B) -- +($  (0,0) ! 2em ! 0 : ($(B)-(Q)$)  $)  
          coordinate [label=center:B] (Bl) circle (6pt);

    \draw[blue]   
          ($ (B) ! 0.45 ! (Q) $) 
          coordinate (tC) circle (2pt);

    \draw[line width=01.5em,->]
          (tC) 
          let \p1 = ($(tC) - (Q)$), 
              \n1={atan2(\x1,\y1)}, %% start angle
              \n2={\n1+90},         %% end angle
              \n3={veclen(\x1,\y1)} %% radius
          in
              arc (\n1:\n2:\n3)
              -- ++(\n2+80:1em)
             ;

\end{tikzpicture}

\end{document}

enter image description here

A.Ellett
  • 50,533
  • Is this the question you were talking about? – Umar Kalim Feb 17 '13 at 00:40
  • @UmarKalim. Unfortunately not. Notice that, if you change the width of the arrow to something such as line width=0.4pt, there's nothing apparently wrong in the appearance. The visual problem arises on account of the line width. – A.Ellett Feb 17 '13 at 00:44
  • Well, the arrow is placed parallel/orthogonal (depending on the view) to the end angle. That’s fixed and the rest is the ratio line width to radius. Where should it point to? – Qrrbrbirlbel Feb 17 '13 at 00:51
  • @Qrrbrbirlbel. I'd like to tweak it about 20 or 30 degrees clockwise. – A.Ellett Feb 17 '13 at 00:54
  • @Qrrbrbirlbel, but I don't want the shaft of the arrow to be different. – A.Ellett Feb 17 '13 at 00:55
  • Ah maybe this one? http://tex.stackexchange.com/questions/95936/create-curved-tikz-single-arrow Still a tweak though – percusse Feb 17 '13 at 00:56
  • @percuße. That's it! So, can we mark this question as a duplicate and link it to that problem/question. – A.Ellett Feb 17 '13 at 00:59
  • Voted for the duplicate – percusse Feb 17 '13 at 01:07
  • Hmmmm. Well, I'm still open to suggestions of how to achieve this. You got the correct link, but I'm having difficulty getting it to work as expected. – A.Ellett Feb 17 '13 at 01:17

0 Answers0