# ellipse intersecting a circle

I am trying to draw an ellipse which intersects the sphere of influence, that is, the dashed circle around the moon. The ellipse needs to pass through (-170.864:.7cm) location along the v0 vector and intersect at (3.56699,.25).

From the picture, I want the ellipse to pass through the intersection of r0 and v0 along v0 and then intersect at the connection of the two lines at the circle around the moon.

\documentclass{article}
\usepackage{tikz, pgfplots}
\begin{document}
\begin{tikzpicture}[line join = round, line cap = round, scale = 2,
>=triangle 45]
\draw (0,0) -- (4,0) node[scale = .45, fill = white] at (2,0) {$D$};
\draw (0,0) -- (-45:4cm);
\begin{scope}[decoration = {markings,
mark = at position 0.5 with {\arrow{>}}, }]
\draw[postaction = decorate] (-45:4cm) arc (-45:0:4cm);
\end{scope}
\draw (0,0) -- (3.56699,.25) node[scale = .75, fill = white]
at (1.99511,.139831) {$r_1$};
\draw (0:2.25cm) arc (0:4.00914:2.25cm) node[scale = .75] at (1.7:2.4cm) {$\gamma_1$};
\begin{scope}[xshift = 4cm]
\draw (0,0) -- (150:.5cm);
\draw (-.2,0) arc (180:150:.2cm);
\node[scale = .75] at (165:.3cm) {$\lambda$};
\end{scope}
\begin{scope}[rotate around = {-80.864: (0,0)}]
\draw[-latex] (0,0) -- (0,-.7) node[left, scale = .75, fill = white, inner sep = .01cm] at (0,-.25) {$\mathbf{r}_0$};
\draw[-latex] (0,-.7) -- (1,-.7) node[left, scale = .75]
at (.4,-.7) {$\mathbf{v}_0$};
\end{scope}
\draw[dashed] (4,0) circle (.5cm);
\draw[dashed] (0,0) circle (.7cm);
\draw (-170.864:.4cm) arc (-170.864:0:.4cm) node[scale = .75,
fill = white, inner sep = .01cm] at (-85:.4cm) {$\nu_1$};
\path (4,0) node {\includegraphics[width = .3cm]{moon.png}};
\path (0,0) node {\includegraphics[width = .6cm]{earth.png}};
\path (-45:4cm) node {\includegraphics[width = .3cm]{moon.png}};
\end{tikzpicture}

\end{document}

• What do you mean by my draw plot command? Your MWE seems to work fine for me. Commented Apr 18, 2013 at 22:22
• @PeterGrill I removed my feeble attempt at constructing the ellipse since nothing appeared. Commented Apr 18, 2013 at 22:23
• I think it would be helpful to include that (even if you have to comment it out) as it might aid in understanding what you are trying to accomplish. Commented Apr 18, 2013 at 22:25
• @PeterGrill I added a better picture and made the question more clear I believe. Commented Apr 18, 2013 at 22:26

So I sort of got luck with a rotation that went right through the sphere of influence point.

\begin{center}
\begin{tikzpicture}[line join = round, line cap = round, scale = 2,
>=triangle 45]
\draw (-170.864:.3cm) arc (-170.864:0:.3cm) node[scale = .75,
fill = white, inner sep = .01cm] at (-85:.3cm) {$\nu_1$};
\draw (-170.864:.5cm) arc (-170.864:-28.996:.5cm) node[scale = .75,
fill = white, inner sep = .01cm] at (-90:.5cm) {$\gamma_0$};
\draw (0,0) -- (4,0) node[scale = .45, fill = white] at (2,0) {$D$};
\draw (0,0) -- (-28.966:4cm);
\begin{scope}[decoration = {markings,
mark = at position 0.5 with {\arrow{>}}, }]
\draw[postaction = decorate] (-28.966:4cm) arc (-28.966:0:4cm);
\end{scope}
\draw (0,0) -- (3.56699,.25) node[scale = .75, fill = white]
at (1.99511,.139831) {$r_1$};
\draw (0:2.25cm) arc (0:4.00914:2.25cm) node[scale = .75] at (1.7:2.4cm)
{$\gamma_1$};
\begin{scope}[xshift = 4cm]
\draw (0,0) -- (150:.5cm);
\draw (-.2,0) arc (180:150:.2cm);
\node[scale = .75] at (165:.3cm) {$\lambda$};
\end{scope}
\begin{scope}[rotate around = {-80.864: (0,0)}]
\draw[-latex] (0,0) -- (0,-.7) node[left, scale = .75, fill = white,
inner sep = .01cm] at (0,-.25) {$\mathbf{r}_0$};
\draw[-latex] (0,-.7) -- (1,-.7) node[left, scale = .75]
at (.4,-.7) {$\mathbf{v}_0$};
\end{scope}
\draw[dashed] (4,0) circle (.5cm);
\draw[dashed] (0,0) circle (.7cm);
\path (4,0) node {\includegraphics[width = .3cm]{moon.png}};
\path (0,0) node {\includegraphics[width = .6cm]{earth.png}};
\path (-28.996:4cm) node {\includegraphics[width = .3cm]{moon.png}};
\begin{scope}[rotate around = {15: (-170.864:.7cm)}]
\clip (-0.69112,-0.111145) -- (3.48,.25) -- (3.5,-1) --
(-0.69112,-2) -- cycle;
\draw (-170.864:.7cm) arc (-170.864:189.136:3cm and 1cm);
\end{scope}
\begin{scope}[rotate around = {15: (-170.864:.7cm)}]
\draw[dashed] (-170.864:.7cm) arc (-170.864:189.136:3cm and 1cm);
\end{scope}
\end{tikzpicture}


Edit:

So I found away to construct the section of the ellipse using an arc without just winging it like I did above.

\documentclass[convert = false]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}

\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{intersections}

\usetikzlibrary{backgrounds}

\tikzset{
partial circle/.style args = {#1:#2:#3}{
insert path = {+ (#1:#3) arc (#1:#2:#3)}
}
}

\begin{document}
\begin{tikzpicture}[line join = round, line cap = round, >=triangle 45,
every label/.append style = {font = \tiny},
dot/.style = {inner sep = 0pt, shape = circle,
draw = black, label = {#1}},
small dot/.style = {minimum size = .05cm, dot = {#1}},
big dot/.style = {minimum size = .1cm, dot = {#1}},
]
\def\d{6}
\def\msoi{1}

\coordinate (O) at (0, 0);
\coordinate (Mi) at (-45:\d);
\coordinate (Mf) at (0:\d);

\begin{scope}[decoration = {markings,
mark = at position 0.32 with {\arrow{latex}}
}]
\draw[postaction = decorate] (O) [partial circle = -60:60:\d];
\end{scope}

\draw (O) -- (Mi);
\draw (O) -- (Mf) node[pos = .5, inner sep = 0, fill = white, font = \tiny]
{D};
\draw[-latex] (O) -- (-135:1.5cm) coordinate (r0)node[left, pos = .7,
font = \tiny] {$$\mathbf{r}_0$$};

\path[rotate = {209.5}, name path global = ell] (r0) arc[x radius = 4.5cm,
y radius = 1.75cm, start angle = 0, end angle = 160];

\foreach \position/\i in {Mi/1, Mf/2}{
\draw[red, name path global/.expanded = circ\i] (\position)
}

\node[coordinate, name intersections = {of = circ2 and ell}] (P1) at
($(intersection-2)$) {};

\begin{pgfonlayer}{background}
\begin{scope}[decoration = {markings,
mark = between positions .1 and 1 step .15 with {\arrow{latex}},
}]
\begin{pgfinterruptboundingbox}
\clip (P1)  rectangle ($(r0) + (-1, -2)$);
\end{pgfinterruptboundingbox}

\draw[postaction = decorate, rotate = {209.5}, name path global = ell]
(r0) arc[x radius = 4.5cm, y radius = 1.75cm, start angle = 0,
end angle = 160];
\end{scope}
\end{pgfonlayer}

\draw[-latex] (O) -- (P1) node[font = \tiny, inner sep = 0, fill = white,
pos = .5] {$$\mathbf{r}_1$$};
\draw[-latex] (Mf) -- (P1) node[font = \tiny, pos = .6, right, fill = white,
inner sep = 0] {$$R_{soi}$$};

\shade[outer color = gray!70!blue!50, inner color = black!30!blue!90]
\shade[outer color = gray!70!blue!50, inner color = black!30!blue!90]
\shade[outer color = green!70!blue!50, inner color = black!30!green!90]

\draw[-latex] let
\p0 = (O),
\p1 = (r0),
\p2 = (Mi),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {1cm},
\n4 = {(\n1 + \n2) / 2}
in (O) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[fill = white, inner sep = 0, font = \tiny] at ([shift = (O)] \n4:\n3)
{$$\nu_0$$};

\draw[-latex] let
\p0 = (O),
\p1 = (Mf),
\p2 = (P1),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {2cm},
\n4 = {(\n1 + \n2) / 2}
in (O) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[fill = white, inner sep = 0, font = \tiny] at ([shift = (O)] \n4:2.2cm)
{$$\nu_1$$};

\draw[-latex] let
\p0 = (Mf),
\p1 = (O),
\p2 = (P1),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.7cm},
\n4 = {(\n1 + \n2) / 2}
in (Mf) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[fill = white, inner sep = 0, font = \tiny] at ([shift = (Mf)] \n4:\n3)
{$$\lambda_1$$};
\end{tikzpicture}
\end{document}


• Maybe I don't understand the question, but I think there are infinite ellipses passing through two points. Why did you choose right that? Commented Apr 19, 2013 at 7:40
• @Luigi I picked that ellipse because it worked when I was playing around with it. If there is a cleaner way, I would like to know. Commented Apr 19, 2013 at 10:22
• I was wondering if you need just an ellipse passing through those two points or a particular one. In the first case, your solution works very well; in the latter, we need more details because there is more than a single solution. Commented Apr 19, 2013 at 10:48
• @Luigi I was looking for a particular one but this one is close enough. I wanted an ellipse with an eccentricity of 0.97228 where the apoapsis is at the departure point. Since I am very close to apo at departure, I was satisfied since I got lucky. But if there is a better way to construct the exact ellipse, that would be great. Commented Apr 19, 2013 at 15:27
• Is it possible to put some title words in the edit instead of added 4698 characters in body to help upvote and understand the update easily for all. Commented Aug 2, 2013 at 3:01