# Tikz: Drawing a line from a focus to the edge of an ellipse

This question is similar to Tikz: connecting two vectors from the focus of an ellipse to the edge but not the same.

In this instance, I want the the length of line to be a specific distance. If there was a circle center at the origin, my lines to the edge will only be in the 1st and 2nd quadrants. I want to construct a line of unit length from F to the edge of the ellipse. I don't know what angle would have this length though. For the second line, I want it to be of length 1.524. These lengths are labelled rone and rtwo respectively.

One more caveat, the angle between rone and rtwo should be 107 degrees which is labelled deltanu.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale = 1.5,
every label/.append style = {font = \small},
dot/.style = {outer sep = +0pt, inner sep = +0pt,
shape = circle, draw = black, label = {#1}},
dot/.default =,
small dot/.style = {minimum size = 2.5pt, dot = {#1}},
small dot/.default =,
big dot/.style = {minimum size = 5pt, dot = {#1}},
big dot/.default =
]
\pgfmathsetmacro{\e}{0.2768}
\pgfmathsetmacro{\etilde}{0.6789}
\pgfmathsetmacro{\rone}{1}
\pgfmathsetmacro{\rtwo}{1.524}
\pgfmathsetmacro{\deltanu}{107}
\pgfmathsetmacro{\a}{1.36}
\pgfmathsetmacro{\am}{1.1442}
\pgfmathsetmacro{\b}{\a * sqrt(1 - \e^2)}
\pgfmathsetmacro{\btilde}{\a * sqrt(1 - (\etilde)^2)}
\pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
\pgfmathsetmacro{\ctilde}{sqrt(\a^2 - (\btilde)^2)}
\node[scale = .75, fill, big dot = {below: $$F$$}] (F) at (0, 0) {};
\node[scale = .75, fill = none, big dot = {below: $$F^*$$}] (FS)
at (-2 * \c cm, 0) {};
\draw (-\c,0) ellipse (\a cm and \b cm);
\draw[red, thick] (0, 0) circle (1.523679cm);
\draw[blue, thick] (0, 0) circle (1cm);
\end{tikzpicture}
\end{document}


My guess would be the intersection library but I don't know how that would be implemented.

-
Can you please state where the lines should start or better what to draw? To be honest the question is in the form of a math problem which is not helping for the TikZ problem. – percusse Jun 17 '13 at 5:42
@dustin \path two circles from F with 1 and 1.54 radius and use intersections with the ellipse. It's the straightforward examples from the manual. If your computation is right the angle should come out correct. – percusse Jun 17 '13 at 5:46
@Jake I added the information from the book. See OP – dustin Jun 17 '13 at 17:36
@Jake I changed the code to show the orbits of Mars and Earth with the ellipse centered at (-\c, 0) to put the focus in relation to the sun being the origin. – dustin Jun 17 '13 at 17:54

## 1 Answer

With the correct value of e = 0.2678, you can use the intersections library to find the points P1 and P2:

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections, calc}
\begin{document}
\begin{tikzpicture}[scale = 1.5,
every label/.append style = {font = \small},
dot/.style = {outer sep = +0pt, inner sep = +0pt,
shape = circle, draw = black, label = {#1}},
dot/.default =,
small dot/.style = {minimum size = 2.5pt, dot = {#1}},
small dot/.default =,
big dot/.style = {minimum size = 5pt, dot = {#1}},
big dot/.default =
]
\pgfmathsetmacro{\e}{0.2768}
\pgfmathsetmacro{\etilde}{0.68}
\pgfmathsetmacro{\rone}{1}
\pgfmathsetmacro{\rtwo}{1.524}
\pgfmathsetmacro{\deltanu}{107}
\pgfmathsetmacro{\a}{1.36}
\pgfmathsetmacro{\am}{1.14}
\pgfmathsetmacro{\b}{\a * sqrt(1 - \e^2)}
\pgfmathsetmacro{\btilde}{\a * sqrt(1 - (\etilde)^2)}
\pgfmathsetmacro{\c}{sqrt(\a^2 - \b^2)}
\pgfmathsetmacro{\ctilde}{sqrt(\a^2 - (\btilde)^2)}
\node[scale = .75, fill, big dot = {below: $$F$$}] (F) at (0, 0) {};
\node[scale = .75, fill = none, big dot = {below: $$F^*$$}] (FS)
at (-2 * \c cm, 0) {};
\draw [name path=ellipse] (-\c,0) ellipse (\a cm and \b cm);
\draw [red, thick, name path=r2] (0, 0) circle (1.523679cm);
\draw [blue, thick, name path=r1] (0, 0) circle (1cm);

\draw [name intersections={of=ellipse and r1}] (F) -- (intersection-1) coordinate (P1) node [fill,big dot=right:P1, minimum size=3pt] {};
\draw [name intersections={of=ellipse and r2}] (F) -- (intersection-1) coordinate (P2) node [fill,big dot=above left:P2, minimum size=3pt] {};

\draw let
\p0=(F),
\p1=(P1),
\p2=(P2),
\n1={atan2(\x1-\x0,\y1-\y0)},
\n2={atan2(\x2-\x0,\y2-\y0)},
\n3={1em}
in (F) +(\n1:\n3) arc [radius=\n3, start angle=\n1, end angle=\n2] node [pos=0.5,above] {\pgfmathparse{\n2-\n1}%
$\pgfmathprintnumber{\pgfmathresult}^\circ$
};
\end{tikzpicture}
\end{document}

-
Can we determine the angle and distance to ensure they match the values given? – dustin Jun 17 '13 at 18:11
It is good to know that they don't fix their errors in the newer editions. I have ed 2 and that errata is for ed 1. – dustin Jun 17 '13 at 18:14
@dustin: I've edited my answer to show how to calculate and print the angle. – Jake Jun 17 '13 at 18:18
@dustin: No, sorry. That could be a good question for Math.sx, though. – Jake Jun 17 '13 at 19:55
I think it may be easier than what we think. \draw (\ctilde, 0) ellipse (\a cm and \btilde cm); so that will plot the other ellipse. The thing I would need to find is the rotation that would bring it to correct location. Then I just need to through in a scope for the rotate around. Any ideas on how to find the rotation angle? – dustin Jun 17 '13 at 21:21