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:
- I want it to plot a general case, namely, the circle's center and radius should be arbitrary as well as the point outside.
- 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):
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}