Draw tangents from point to ellipse using PSTricks

I'd like to create an ellipse (using psellipse, say). Call it E. And I'd like to specify a point P outside E. And then I'd like to construct, using PSTricks, the two rays starting at P and tangent to E.

Is there an easy way to do this?

I know I could do this by doing it for a circle and then "stretching" the picture to make it an ellipse, but that complicates other things I'd like to do. And of course one could figure this all out using explicit computations. But I'd like to know if there is some simple straightforward way.

-
Are you sure stretching "circle-point tangency system" equals to "ellipse-point one"? –  xport Jan 16 '11 at 16:13
@xport: linear transformations don't change tangency (you can't get a second point of intersection by some stretching). –  Caramdir Jan 16 '11 at 17:50

\documentclass{article}

\begin{document}

\begin{pspicture}[showgrid](-4,-2)(4,3)
\psEllipseTangents(0,0)(3,2)(4,3)\psdot(4,3)
\pcline[linecolor=red,nodesepB=-15mm](4,3)(EllipseT1)
\pcline[linecolor=red,nodesepB=-15mm](4,3)(EllipseT2)
\psdots(EllipseT1)(EllipseT2)
\psellipse[fillcolor=cyan!30,fillstyle=solid](0,0)(3,2)
\end{pspicture}

\end{document}


-
I am waiting for the algebraic option for all tangents to conic curves. :-) –  xport Jan 17 '11 at 15:32
there will be a macro \psEllipseTangents which defines two nodes. –  Herbert Jan 18 '11 at 7:57
This is very nice. It's just what I was looking for. Thanks. –  Carl Offner Jan 18 '11 at 23:19

I advise you to use GeoGebra to draw such Euclidean Geometry graphs. It has a friendly GUI and can export PSTricks code easily.

http://www.geogebra.org/cms/

-
the PSTricks export of geogebra is lousy ... –  Herbert Jan 17 '11 at 10:22
@Herbert: I agree. Usually the code exported by GeoGebra needs to be modified manually. But it's easy to use, no complex caculations are needed. –  Leo Liu Jan 18 '11 at 5:36
this is not my point. With PSTricks you also do not need complex calculations, because every macro which is useful will be part of the package, just like \psEllipseTangents. However, with a gui one should export the image to PDF and not to tikz or PSTricks ... –  Herbert Jan 18 '11 at 7:56

You may want to have a look at the pst-eucl package.

-
It seems that pst-eucl can only draw tangents of circle. I'm not sure if there are some other subpackages. –  Leo Liu Jan 16 '11 at 17:09