# TiKZEvolution of an orbit

#### dwsmith

##### Well-known member
Here is the evolution of an orbit from an ellipse to a parabola to a hyberbola.

[LATEXS]\documentclass[convert = false, tikz]{standalone}

\usetikzlibrary{calc}
\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]
\coordinate (E) at (0, 0);

\def\dom{5}

\draw (E) [partial circle = -15:150:\moonrad];
\shadedraw[gray, left color = orange!75!blue, right color = blue!75!black]

\foreach \a/\b/\col/\type in
{.75/1/black/dashed, 1.25/2.25/red/dotted, 1.5/3/black/}{
\draw[\type, \col] (0, -.5)
arc[x radius = \a, y radius = \b, start angle =-90, end angle = 270];
}

\begin{scope}
\begin{pgfinterruptboundingbox}

\begin{scope}[shift = {(0, -.5)}]
\draw[blue] plot[domain = 0:\dom, samples = 500] ({\x}, {.5 * (\x)^2});
\end{scope}

\foreach \a/\angle/\i in {1.5/30/5, 2/45/0, 3/60/0}{
\pgfmathsetmacro{\b}{\a / tan(\angle)}
\begin{scope}[shift = {(0, -\a - .5)}]
\draw plot[domain = 0:{\dom + \i}, samples = 500]
({\x}, {\a * sqrt(1 + (\x / \b)^2)});
\end{scope}
}
\end{pgfinterruptboundingbox}
\end{scope}
\end{tikzpicture}
\end{document}[/LATEXS]

Last edited: