# TikZ: Drawing an ellipse through two points

I am trying to construct a portion of an ellipse that connects point P1 and P2 but I don't know anything about the ellipse besides that F is one of the foci. All I know is that an elliptic arc connects the two points. I tried using \draw let ... and then specifying the start and end angle but I don't what the x radius and y radius would be nor the orientation of the ellipse. Any ideas on how to construct this? I have a similar question which never received a definitive answer since it was more restrictive. That post can be found here ellipse intersecting a circle but I was just winging it there.

  \documentclass{article}
\usepackage{tikz, intersections}
\begin{document}
\begin{tikzpicture}[
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 = 2pt, dot = {#1}},
small dot/.default =,
big dot/.style = {minimum size = 4pt, dot = {#1}},
big dot/.default =,
line join = round, line cap = round, >=triangle 45
]

\node[scale = .75, fill = black, big dot = {below: $$F$$}] (F)
at (0, 0) {};
\node[scale = .75, fill = black, big dot = {below: $$P_1$$}] (P1)
at (2, 0) {};
\node[scale = .75, fill = black, big dot = {above, right = .25cm: $$P2$$}]
(P2) at (-2, 2) {};
\draw[-latex] (F) -- (P1) node[scale = .75, fill = white, inner sep = 0cm,
shape = circle, pos = .5] {$$\mathbf{r}_1$$};
\draw[-latex] (F) -- (P2) node[scale = .75, fill = white, inner sep = 0cm,
shape = circle, pos = .5] {$$\mathbf{r}_2$$};
\draw (-1, 0) -- (F);
\draw let
\p0 = (F),
\p1 = (P1),
\p2 = (P2),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.4cm}
in (F) +(\n1:\n3) arc [radius = \n3, start angle = \n1, end angle = \n2]
node[scale = .75, pos = .5, above = .4cm] {$$\Delta\nu$$};
\draw (P1) -- (P2) node[scale = .75, fill = white, inner sep = 0cm,
shape = circle, pos = .5] {$$c$$};
\end{tikzpicture}
\end{document}


• The problem is underspecified, you need at least five points to define an ellipse (or some other information like the eccentricity and the rotation) – Jake Jun 23 '13 at 2:46
• @Jake unfortunately, that is all the information I have. – dustin Jun 23 '13 at 2:48
• I am interested to know how to do an arc of an ellipse given 3 points and the 2 radii lengths, and I don't want full ellipse, just the elliptical arc through the 3 points. – Nicholas Hamilton Jun 23 '13 at 2:58
• @ADP it is a tough problem to handle with so little information. – dustin Jun 23 '13 at 3:11
• Seems to me there are two parts to this question: (1) A geometry problem -- how to construct an ellpse from end-points and focus, and (2) how to draw the thing in tikz. You might have more luck getting an answer to part #1 on math.stackexchange. – bubba Jun 23 '13 at 7:06

Well, as Jake commented you have an underdefined problem so the best approach is the manually placed arc and be done with it. Because to automate it, you have to supply more info. A possibility is to make a quarter arc directly

  \documentclass[tikz]{standalone}
\usetikzlibrary{arrows,calc}

\begin{document}

\begin{tikzpicture}[
dot/.style = {outer sep = +0pt, inner sep = +0pt, shape = circle, draw = black, label = {#1}},
small dot/.style = {minimum size = 1pt, dot = {#1}},
big dot/.style = {minimum size = 2pt, dot = {#1}},
line join = round, line cap = round, >=triangle 45
]
\node[ fill = black, big dot = {below: $$F$$}] (F) at (0, 0) {};
\node[ fill = black, big dot = {below: $$P_1$$}] (P1)  at (2, 0) {};
\node[ fill = black, big dot = {above right=.25cm:$$P_2$$}] (P2) at (-2, 2) {};

\draw let
\p0 = ($(P2)-(F)$),
\p1 = ($(P1)-(P2)$)
in  (P2|-P1) ++(\x1,0) arc (0:270:\x1 and \y0);

\end{tikzpicture}
\end{document}


A possible visual solution is to add

  \documentclass[tikz]{standalone}
\usetikzlibrary{arrows,calc}

\begin{document}

\begin{tikzpicture}[
dot/.style = {outer sep = +0pt, inner sep = +0pt, shape = circle, draw = black, label = {#1}},
small dot/.style = {minimum size = 1pt, dot = {#1}},
big dot/.style = {minimum size = 2pt, dot = {#1}},
line join = round, line cap = round, >=triangle 45
]
\node[ fill = black, big dot = {below: $$F$$}] (F) at (0, 0) {};
\node[ fill = black, big dot = {below: $$P_1$$}] (P1)  at (2, 0) {};
\node[ fill = black, big dot = {above right=.25cm:$$P_2$$}] (P2) at (-2, 2) {};

\begin{scope}[decoration={%
markings,%
mark=at position .5 with {\arrow[line width=0.4pt]{triangle 45}}%
},
]
\pgfpathmoveto{\pgfpointanchor{P1}{center}}
\pgfpatharcto{2.55cm}{4cm}{0}{0}{1}{\pgfpointanchor{P2}{center}}
\pgfgetpath\temppath
\pgfusepath{draw}
\pgfsetpath\temppath
\pgfdecoratecurrentpath{markings}
\end{scope}

\end{tikzpicture}
\end{document}


• What if I wanted to added an arrow at pos = .5 of to this path: \pgfpathmoveto{\pgfpointanchor{P1}{center}} \pgfpatharcto{2.55cm}{4cm}{0}{0}{1}{\pgfpointanchor{P2}{center}} \pgfusepath{stroke} How can this be done? – dustin Jun 23 '13 at 17:46
• @dustin See the edit – percusse Jun 23 '13 at 18:34
• @percusse: Maybe I'm getting something wrong here, but I think your second solution doesn't actually solve the problem: (F) isn't a focus of the ellipse in this case. – Jake Jun 23 '13 at 19:14
• @Jake No you are right. But you can make it look-like it is a focal point otherwise there is an underdefined set of equations that needs to be dealt with. With a slight nudge, you can consider (F) as the focal point of the ellipse almost vertical but tilted a little to the left. But to be honest I don't feel like going through all the computations to fix an approximation that would visually won't matter much... But, if you have a better alternative, please go ahead. – percusse Jun 23 '13 at 20:55
• @Jake No problem at all. In another news, I'm kinda solving linear equations now but far from production state :) fpu is really difficult to tame, L3 is difficult to learn heh. – percusse Jun 23 '13 at 21:09