[Tex/LaTex] Tangents to a circle from a point outside of it (tikz)

circlesplottikz-pgf

I'm trying to plot in TikZ the two tangents to a fixed circle passing through a given point.

In some details, given an arbitrary circle centered at C with with radius r, and a point P outside of the circle. I want to plot the two tangents from P to the circle. My problems are mainly:

  1. I want it to plot a general case, namely, the circle's center and radius should be arbitrary as well as the point outside.
  2. The formulas, that I came up with, are not too friendly and involves cubic factors of coordinates and square roots.

Any tips, advices, code fragments etc. will be very welcome!

Epilog: This question was actually, the first step towards the generation of some plots related to the Poncelet's Porism. I felt on one hand that the built in methods, in TikZ related to the notion of tangents, were too hard for me to use. On the other hand, the tkz-euclid is too much in French 🙂 Finally, I reverted to PiScript, which is easier to program in my mind. Here is one of the results I obtained (here's the source code, if you're interested):

enter image description here

As for the answer I chose; it is the one which provides a solution to the question as I posed it in the simplest manner. Thank you all for the help!

Best Answer

In the pgf manual page 130 (ver. 3.10), you have the exact example. I just copy it from there for convenience in case anybody needs. It requires \usetikzlibrary{calc}

\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,2);
\coordinate (a) at (3,2);
\node [circle,draw] (c) at (1,1) [minimum size=40pt] {$c$};
\draw[red] (a) -- (tangent cs:node=c,point={(a)},solution=1) --
(c.center) -- (tangent cs:node=c,point={(a)},solution=2) -- cycle;
\end{tikzpicture}