# Tangent to circle given point on circle

I've been able to draw tangent lines to a circle at a given point on the circle, and I've done so in two ways (using the calc library, and using the /tikz/turn feature). But I must admit I don't fully understand /tikz/turn and don't know if there is an advantage of using calc or turn (or some other approach).

My current MWE is below. My questions are:

1) I (think) that I get how the blue line is drawn using "turn" (draw a line from center of circle to point on circle, then rotate clockwise by 90 degrees relative to incoming direction and then continue for 2 cm). But the red line is confusing to me. If I simply start at a point on the circle (P in this case), how does TikZ know what direction to "turn" relative to? Somehow it understands that +/- 90 is tangent to the circle... Is there implicitly a line from (0,0) to the point P (to define the angle=0 direction)?

2) Both the red curve and the black curve (made with calc library) give me what I need. Is there any advantage of one over the other?

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
[
scale=1,
point/.style = {draw, circle, fill=black, inner sep=0.5pt},
]

\node (C) at (0,0) [point]{};

% Using the calc library
\draw (P) -- ($(P)!2!-90:(C)$);
\draw (P) -- ($(P)!2!90:(C)$);

% using /tikz/turn
\draw[->,thick, color=blue] (C) -- (P) -- ([turn]-90:2cm);
% this is the command that I don't understand
\draw[->,thick, color=red] (P) -- ([turn]90:1cm);

\end{tikzpicture}
\end{document}

• Welcome to TeX.SX! – user31729 Sep 29 '14 at 16:58
• Since (P) is the first point there is an implicit (0,0) in effect for translation. – percusse Sep 29 '14 at 17:10
• Got it. And how about the relative merits of using "turn" vs. the calc library? In the case where you have a circle, I don't see an advantage of one over the other, but would love to know if I'm missing something. – James Sep 29 '14 at 19:54
• @James I don't see any. Use whatever is convenient for you. The differences will arise when you do complicated stuff and then you can decide which one is better over the other. Usually that happens when you scale/rotate/... things around. So it is difficult to guess at the outset. – percusse Sep 29 '14 at 23:03

The voodoo effect comes from the fact that when a coordinate is omitted origin is assumed and this happens to be the center of the circle. If you change the starting point the mystery goes away rather quickly.

I've placed more arrows to show the effect when the paths start from different coordinates.

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
[point/.style = {draw, circle, fill=black, inner sep=0.5pt}]
\draw[style=help lines] (0,-1) grid[step=1cm] (5,4);

\node (C) at (2,1) [point,label=0:C]{};