# Plotting line from angle command in TikZ

I'm trying to use the following code to get a line between the perimeters of the circles, the --(b)++(135:16pt) is the bit that I'm having the problem with, it seems that it draws it to (b) and neglects the ++ part after, is there any way to bracket this so it draws it to ((b)++(135:16pt)). Also, the same goes with the definition of coordinate (c), it thinks it's the same as (b) not (b)++whatever.

\begin{document}
\begin{center}
\begin {tikzpicture}[scale=1]
\coordinate (a) at (0pt,0);
\coordinate (b) at (130pt,0);
\coordinate(c) at (b)++(0,10pt);
\draw (a) circle (28pt) (a) circle (22pt) (a)circle(20pt);
\draw (b) circle (16pt) (b) circle (12pt) (b)circle(10pt);
\draw(a)++(55:28pt)--(b)++(135:16pt);
\end {tikzpicture}
\end{center}
\end{document}

-
 That syntax is not good for TikZ since it needs to understand a coordinate and some magic should happen inside the ( and ) characters. You can use \draw([shift={(55:28pt)}]a)--([shift={(135:16pt)}]b) ;. However, I would suggest to switch to calc library notation with $ use. Check the manual for further details. – percusse Feb 19 '12 at 13:00 Will doing it with the calc library have any effect on the line quality? I'm noticing that as it's drawn now it's quite jagged. Perhaps it's just the angle though. – Andy Feb 19 '12 at 13:24 There shouldn't be an interference on the line quality since it only affects the coordinate location. Try \draw($(a)+(55:28pt)$) -- ($(b)+(135:16pt)$); by adding \usetikzlibrary{calc}. – percusse Feb 19 '12 at 13:28 Thanks percusse, I had no idea that using the calc notation was that easy. – Andy Feb 19 '12 at 13:41 By the way if you want to create tangents, have a look at How can I draw a tangent ending smoothly in a circle? – percusse Feb 19 '12 at 14:14 ## 1 Answer There are several techniques to do this. One of them is suggested by percusse. The following shows the first two techniques in one example. Later I show a better example. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{center} \begin {tikzpicture}[scale=1] \coordinate (a) at (0pt,0); \coordinate (b) at (130pt,0); \coordinate(c) at (b)++(0,10pt); \draw (a) circle (28pt) (a) circle (22pt) (a)circle(20pt); \draw (b) circle (16pt) (b) circle (12pt) (b)circle(10pt); % First techique: \draw (a)+(55:28pt) coordinate (a@55) (b)+(135:16pt) coordinate (b@135) (a@55) -- (b@135); % Second technique (requires calc.) \draw ($(a)+(55:28pt)$) -- ($(b)+(-15:16pt)$); \end {tikzpicture} \end{center} \end{document}  This example is based on your code but it's not very maintainable. For example, what if the radius of one circle changes: you'd have to make several changes. The following shows how you may overcome this. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{center} \begin {tikzpicture}[scale=1] \draw let \n{first outer}={28pt}, \n{first middle}={20pt}, \n{first inner}={10pt}, \n{second outer}={16pt}, \n{second middle}={12pt}, \n{second inner}={10pt}, \n{first angle}={55}, \n{second angle}={135} in (0,0) coordinate (first centre) (130pt,0) coordinate (second centre) \foreach \radius in {outer,middle,inner} { (first centre) circle (\n{first \radius}) (second centre) circle (\n{second \radius}) } ($(first centre) +(\n{first angle}:\n{first outer})$) -- ($(second centre) +(\n{second angle}:\n{second outer})\$);
\end {tikzpicture}
\end{center}
\end{document}

-
 Nice! Do you mind adding my first comment and finally using the node syntax \draw (a.55) -- (b.135) as additional solutions such that it becomes more comprehensive? – percusse Feb 19 '12 at 13:43 I meant after making a,b circle nodes. – percusse Feb 19 '12 at 13:49 Thank you Marc for such a detailed reply! I'd been wondering how I could make my code more adaptable to changes- your second set of code shows me perfectly, i'll study this and try and implement it in the next diagram I draw. Is the easiest way to construct a 'fillet' or blend between that line and the circle to reduce the line length and then use a short bezier curve to connect- using a control point with trial and error until it looks 'right'? – Andy Feb 19 '12 at 13:56 @percusse Is this what you meant? – Marc van Dongen Feb 19 '12 at 14:06 @MarcvanDongen Thanks! – percusse Feb 19 '12 at 14:08
show 1 more comment