I wonder if one can draw tangent lines out of a point to a path of an ellipse using tikz. Actually for the case of circle paths this can be accomplished easily as given in the tikz-pgf manual, but for other paths it wouldn't be an easy task.
I have tried to solve this problem with the help of some threads, but my solution, unfortunately, relies on some mathematical background. I wonder if I could solve the same problem with pure tikz.
Here is my solution:
\documentclass{standalone}
\usepackage{tikz,pgfplots}
\usetikzlibrary{calc,intersections,arrows}
\usepackage{times}
\begin{document}
\begin{tikzpicture}[scale=1,>=latex',scale=1.5,outer sep=0,inner sep=0,line width=0.7pt]
\def\a{2} \def\b{1} % radii of Ellipse
\def\cx{0} \def\cy{0} % determines center of Ellipse
\def\xp{0} \def\yp{-5} % coordinates of point P
\coordinate (P) at (\xp,\yp);
\coordinate (A) at (0,\b); % up
\coordinate (B) at (0,-\b); % down
\coordinate (C) at (\a,0); % right
\draw[name path=ellipse,fill=gray!30,opacity=0.5](\cx,\cy)circle[x radius=\a,y radius=\b];
\path[name path=linePC] (P)--(C);
\path[name path=linePC] (P)--(C);
\path [name intersections={of = ellipse and linePC}];
\coordinate (E) at (intersection-2);
\coordinate (F) at (intersection of A--C and B--E);
\path let \p1=(F) in node (G) at (-1.2*\a,\y1){};
\path[name path=lineFG] (F)--(G);
\path [name intersections={of = ellipse and lineFG}];
\coordinate (X) at (intersection-1);
\coordinate (Y) at (intersection-2);
\draw (X)--(P)--(Y);
%%%%%%%%%%%%%%%%%%%%%% Second Ellipse%%%%%%%%%%%%%%
\def\a{1} \def\b{0.5} % radii of Ellipse
\def\cx{0} \def\cy{0} % determines center of Ellipse
\def\xp{0} \def\yp{-5} % coordinates of point P
\coordinate (P) at (\xp,\yp);
\coordinate (A) at (0,\b); % up
\coordinate (B) at (0,-\b); % down
\coordinate (C) at (\a,0); % right
\draw[name path=ellipse,fill=white](\cx,\cy)circle[x radius=\a,y radius=\b];
\path[name path=linePC] (P)--(C);
\path[name path=linePC] (P)--(C);
\path [name intersections={of = ellipse and linePC}];
\coordinate (E) at (intersection-2);
\coordinate (F) at (intersection of A--C and B--E);
\path let \p1=(F) in node (G) at (-1.2*\a,\y1){};
\path[name path=lineFG] (F)--(G);
\path [name intersections={of = ellipse and lineFG}];
\coordinate (X) at (intersection-1);
\coordinate (Y) at (intersection-2);
\draw (X)--(P) (P)--(Y);
\draw [->,thin](0,-5.5)--(0,1.5) node[above]{$z$};
\draw [<-,shorten <=0.2pt,thin](P)--+(0.4,-0.1) node[right]{Gap};
\draw [->,thin](0,-2.2) arc (90:65.4:2.5);
\node [fill=white] at (0.5,-2.5){$\theta_2$};
\draw [->,thin](0,-3.5) arc (90:79:1.6);
\node at (0.13,-3.7){$\theta_1$};
\end{tikzpicture}
\end{document}
I appreciate your help and thank you in advance.


