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?
Made with:
\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
[
scale=1,
point/.style = {draw, circle, fill=black, inner sep=0.5pt},
]
\def\rad{2cm}
\node (C) at (0,0) [point]{};
\draw (C) circle (\rad);
\node (P) at +(160:\rad) [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}
(P)
is the first point there is an implicit(0,0)
in effect for translation.