I would like to avoid setting too many of the values for the following picture too rigidly. For example, I would like to be able to set the position of point A
and forever after that be able to retrieve the distance from other points to A
through the \path ... let ... in ...
structure.
Here's my MWE:
\documentclass{standalone}
\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:7) 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)});
%% these lines do work, but I don't want to explicitly state the radius as "7"
%% BEGIN <remove these lines>
\draw [line width=0.4pt,red]
(Q) -- +(320:7)
coordinate (B) circle (2pt);
%% END <remove these lines>
%% after removing the above lines, uncomment the following lines to get error.
%% no matter how I try to tweak these line, I can't get it to work
%% \draw [line width=0.4pt,red]
%% let \p1 = ($(A) - (Q)$) in
%% (Q) -- +(320:{veclen(\x1,\y1)})
%% 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}
After removing the lines I've flagged to be removed and uncommenting the following block of code, I get the following error:
! Package tikz Error: Giving up on this path. Did you forget a semicolon?.
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.30 (Q) -- +(320:{veclen(\x1,\y1)})
?
In case I'm being unclear about what to remove and what to uncomment, here's the MWE which produces this error.
\documentclass{standalone}
\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:7) 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)$) in
(Q) -- +(320:{veclen(\x1,\y1)})
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}
Why is it just this particular \path ... let ... in
that's failing?
Incidentally
I don't like how the arrow is oriented. Recently, there was a post on this site which explalined how to correct such arrows. But no matter how much I've searched, I can't seem to find it. Anyone know the link?