Welcome to our community

Be a part of something great, join today!

TiKZ Hyperbolic trajectories from a parking orbit

dwsmith

Well-known member
Feb 1, 2012
1,673
This is a fun TikZ picture to play with.

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

\usepackage[utf8]{inputenc}
% Euler for math | Palatino for rm | Helvetica for ss | Courier for tt
\renewcommand{\rmdefault}{ppl} % rm
\linespread{1.05} % Palatino needs more leading
\usepackage[scaled]{helvet} % ss
\usepackage{courier} % tt
% \usepackage{euler} % math
\usepackage{eulervm}
% a better implementation of the euler package (not in gwTeX)
\normalfont
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\usepackage[usenames, dvipsnames]{xcolor}
\usepackage{tikz}

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

\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0, 0);

\def\angle{50}
\def\circradius{.35}
\def\a{1.15}
\def\asymlen{4.75}

\pgfmathsetmacro{\b}{\a / tan(\angle)}

\draw[dashed, latex-] (-4, 0) -- (O) node[font = \tiny, pos = .14, above]
{To the Sun};
\draw[dashed, name path = dashed] (0, -4) -- (0, 2.5);
\draw[-latex] (0, 2.65) -- (0, 3.5) node[font = \tiny, above]
{\(\mathbf{V}_1\)};
\draw[thick, gray, name path global = circ] (O) circle[radius = 3cm];
\draw (O) circle[radius = \circradius];
\draw (O) -- (-\angle:1.5cm) coordinate (C);
\draw (O) -- ({180 - \angle}:3cm) node[pos = .5, font = \tiny,
rotate = {360 - \angle}, align = center]
{Aspe line of the\\ departure hyperbola};
\draw[red, name path = asym1] (-\angle:1.5cm) -- +(0, 4.5) coordinate (P2)
node[font = \tiny, rotate = -90, pos = .5, above] {Asymptote};

\shadedraw[gray, left color = orange!80!white!30!red!50,
right color = blue!90!green!70!purple!30] (O) circle[radius = .2cm];

\filldraw[black] (-\angle:.35cm) circle[radius = .02cm] node[below,
font = \tiny] {P};

\begin{scope}[rotate = {90 - \angle}, shift = {(0, {-\a - \circradius})},
on background layer]
\draw[red, -latex] plot[domain = 0:3, samples = 100]
({\x}, {\a * sqrt(1 + (\x / \b)^2)}) node[font = \tiny, above, black]
{\(\mathbf{v}_{\infty}\)};

\begin{pgfinterruptboundingbox}
\path[name path global = asym2] ({180 - \angle}:0) --
({180 - \angle}:7);
\end{pgfinterruptboundingbox}

\path[name intersections = {of = circ and asym2, by = P1}];

\draw[dashed, red] ({180 - \angle}:0) -- (P1);
\end{scope}

\draw[on background layer] let
\p0 = (C),
\p1 = (O),
\p2 = (P2),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.75cm},
\n4 = {(\n1 + \n2) / 2}
in (C) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[font = \tiny] at ([shift = (C.center)] \n4:.5cm) {\(\beta\)};

\begin{pgfinterruptboundingbox}
\path[name path global = perp] (-1, 2.49) -- (5, 2.49);
\end{pgfinterruptboundingbox}

\path[name intersections = {of = dashed and perp, by = P3}];
\path[name intersections = {of = asym1 and perp, by = P4}];

\draw[latex-latex] (P3) -- (P4) node[pos = .5, fill = white, inner sep = 0,
font = \tiny] {\(\Delta\)};
\end{tikzpicture}
\end{document}
[/LATEXS]

You can play around with the angle Latex Code:

\def\angle{50}

by changing the number. Everything is built off of this angle so the picture will adjust as you change it.

Additionally, you can play around with these parameters (below):
Latex Code:

\def\circradius{.35} \def\a{1.15}



As you adjust your angle, the hyperbola will be shorten or lengthened depending on your adjustment. You can increase or decrease by adjusting Latex Code:

domain = 0:3

in the code below.
Latex Code:

draw[red, -latex] plot[domain = 0:3, samples = 100] ({\x}, {\a * sqrt(1 + (\x / \b)^2)}) node[font = \tiny, above, black] {\(\mathbf{v}_{\infty}\)};



You only need to adjust the 3. Lower will shorten the hyperbola and higher will lengthen it. If you remove 0 and add the negative symmetric value, you will plot the whole portion of this piece of the hyperbola.

 
Last edited:

dwsmith

Well-known member
Feb 1, 2012
1,673
This is one is if you are being overtaken by the planet. It also incorporates a capture orbits and the turn angle delta.

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

\usepackage[utf8]{inputenc}
% Euler for math | Palatino for rm | Helvetica for ss | Courier for tt
\renewcommand{\rmdefault}{ppl} % rm
\linespread{1.05} % Palatino needs more leading
\usepackage[scaled]{helvet} % ss
\usepackage{courier} % tt
% \usepackage{euler} % math
\usepackage{eulervm}
% a better implementation of the euler package (not in gwTeX)
\normalfont
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\usepackage[usenames, dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{fp}

\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{backgrounds}
\usetikzlibrary{intersections}
\usetikzlibrary{fixedpointarithmetic}

\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0, 0);

\def\angle{310}
\def\circradius{.35}
\def\a{1.15}
\def\asymlen{4.75}

\pgfmathsetmacro{\b}{\a / tan(\angle)}


\draw[dashed, latex-] (4, 0) -- (O) node[font = \tiny, pos = .14, above]
{To the Sun};
\draw[dashed, name path = dashed] (0, 4) -- (0, -2.5);
\draw[-latex] (0, -2.65) -- (0, -3.5) node[font = \tiny, below]
{\(\mathbf{V}_2\)};
\draw[thick, gray, name path global = circ] (O) circle[radius = 3cm];
\draw (O) -- (-\angle:1.5cm) coordinate (C);
\draw (O) -- ({180 - \angle}:3cm) node[pos = .7, font = \tiny,
rotate = {360 - \angle}, align = center]
{Aspe line of the\\ arrival hyperbola};
\draw[red, name path = asym1] (-\angle:1.5cm) -- +(0, -4.5) coordinate (P2)
node[font = \tiny, rotate = -90, pos = .5, above] {Asymptote};
\draw[dashed] (-\angle:1.5cm) -- +(0, 1) coordinate (P5);

\shadedraw[gray, left color = orange!80!white!30!red!50,
right color = blue!90!green!70!purple!30] (O) circle[radius = .2cm];

\filldraw[black] (-\angle:.35cm) circle[radius = .02cm] node[above,
font = \tiny] {P};

\begin{scope}[rotate = {90 - \angle}, shift = {(0, {-\a - \circradius})},
on background layer]
\draw[OliveGreen, dashed, -latex]
plot[domain = 0:3, samples = 100] ({\x}, {\a * sqrt(1 + (\x / \b)^2)});
\draw[red, latex reversed-]
plot[domain = -2.8:0, samples = 100] ({\x}, {\a * sqrt(1 + (\x / \b)^2)});
\draw[red] plot[domain = -3.1:-2.8, samples = 100]
({\x}, {\a * sqrt(1 + (\x / \b)^2)}) node[font = \tiny, below left, black]
{\(\mathbf{v}_{\infty}\)};

\begin{pgfinterruptboundingbox}
\path[name path global = asym2] ({\angle}:0) --
({360 - \angle}:7);
\end{pgfinterruptboundingbox}


\path[name intersections = {of = circ and asym2, by = P1}];

\draw[dashed, red] ({\angle}:0) -- (P1);
\end{scope}

\draw[on background layer, fixed point arithmetic] let
\p0 = (C),
\p1 = (O),
\p2 = (P1),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.75cm},
\n4 = {(\n1 + \n2) / 2}
in (C) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[font = \tiny] at ([shift = (C.center)] \n4:.5cm) {\(\beta\)};

\draw[on background layer, -latex, fixed point arithmetic] let
\p0 = (C),
\p1 = (P5),
\p2 = (P1),
\n1 = {atan2(\x1 - \x0, \y1 - \y0) - 360},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.75cm},
\n4 = {(\n1 + \n2) / 2}
in (C) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[font = \tiny, fill = white, inner sep = 0] at
([shift = (C.center)] \n4:\n3) {\(\delta\)};

\begin{pgfinterruptboundingbox}
\path[name path global = perp] (-1, -2.49) -- (5, -2.49);
\end{pgfinterruptboundingbox}

\path[name intersections = {of = dashed and perp, by = P3}];
\path[name intersections = {of = asym1 and perp, by = P4}];

\draw[latex-latex] (P3) -- (P4) node[pos = .5, fill = white, inner sep = 0,
font = \tiny] {\(\Delta\)};

\begin{scope}[rotate = {90 - \angle}, decoration = {markings,
mark = at position 0.0 with {\arrow{latex}},
mark = at position 0.5 with {\arrow{latex}}
},
on background layer]
\draw[blue, postaction = decorate] (0, .15)
ellipse[x radius = .35cm, y radius = .5cm];
\end{scope}
\end{tikzpicture}
\end{document}[/LATEXS]

 
Last edited:

dwsmith

Well-known member
Feb 1, 2012
1,673
With the previous two, we need to take off parallel to the asymptote and arrive parallel to the asymptote. In this case, we are doing a planetary flyby so we can come in from any angle. With less restrictions, we can automate more process in the \(\LaTeX\) code such as find the asymptotes. Also, we have the components of the velocity vectors built off the the incoming and outgoing paths.

Becareful with the \alpha_2 node. I had to hard code that arc and node in so it will not adjust. I couldn't find a clever way to automate that so it will adjust when the picture is changed. Maybe someone else can think of a way to do this.

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

\usepackage[utf8]{inputenc}
\renewcommand{\rmdefault}{ppl}
\linespread{1.05}
\usepackage[scaled]{helvet}
\usepackage{courier}
\usepackage{eulervm}
\normalfont
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\usepackage[usenames, dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{fp}

\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{backgrounds}
\usetikzlibrary{intersections}
\usetikzlibrary{fixedpointarithmetic}

\begin{document}
\begin{tikzpicture}[
every label/.append style = {font = \tiny},
dot/.style = {outer sep = 0, inner sep = 0,
shape = circle, draw = black, label = {#1}},
dot/.default =,
small dot/.style = {minimum size = .05cm, dot = {#1}},
small dot/.default =,
big dot/.style = {minimum size = .1cm, dot = {#1}},
big dot/.default =,
line join = round, line cap = round, >=triangle 45
]
\def\angle{50}
\def\peri{.5}
\def\planet{.4}
\def\a{1.25}

\pgfmathsetmacro{\b}{\a / tan(\angle)}

\coordinate (O) at (0, 0);

\draw[-latex] (O) -- (3.5, 0) node[below left, font = \tiny] {\(\mathbf{V}\)};
\draw[-latex] (3.5, 0) -- +(1, 0) node[right, font = \tiny]
{\(\hat{\mathbf{u}}_V\)};
\draw[-latex] (0, 3.5) -- +(0, 1) node[above, font = \tiny]
{\(\hat{\mathbf{u}}_S\)};
\draw[thick, gray, name path global = soi] (O) circle[radius = 3.5cm];

\begin{scope}[rotate = {110}, shift = {(0, {-\a - \peri})},
decoration = {markings,
mark = at position 0.20 with {\arrow{latex}},
mark = at position 0.80 with {\arrow{latex}}
}]
\draw[red, postaction = decorate, name path global = hyper]
plot[domain = -2.95:2.95, samples = 100]
({\x}, {\a * sqrt(1 + (\x / \b)^2)});
\draw[dashed] plot[domain = 0:3, samples = 100] ({\x}, {\a / \b * \x})
coordinate (P1);

\path plot[domain = 0:-3, samples = 100] ({\x}, {-\a / \b * \x})
coordinate (P2);

\draw[dashed] plot[domain = -3:0, samples = 100] ({\x}, {-\a / \b * \x})
coordinate (I);
\draw plot[domain = 0:.5, samples = 100] ({\x}, {-\a / \b * \x})
coordinate (P3);
\draw[dashed] (O) -- (I);

\shadedraw[gray, inner color = blue!40!green,
outer color = black!50!blue!50] (O) circle[radius = \planet];

\draw[fixed point arithmetic] let
\p0 = (I),
\p1 = (O),
\p2 = (P1),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.75cm},
\n4 = {(\n1 + \n2) / 2}
in (I) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[fill = white, inner sep = 0, font = \tiny] at (\n4:\n3) {\(\beta\)};

\draw[fixed point arithmetic] let
\p0 = (I),
\p1 = (O),
\p2 = (P2),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.75cm},
\n4 = {(\n1 + \n2) / 2}
in (I) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[fill = white, inner sep = 0, font = \tiny] at (\n4:\n3) {\(\beta\)};

\draw[fixed point arithmetic] let
\p0 = (I),
\p1 = (P1),
\p2 = (P3),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.75cm},
\n4 = {(\n1 + \n2) / 2}
in (I) +(\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[fill = white, inner sep = 0, font = \tiny] at (\n4:\n3) {\(\delta\)};
\end{scope}

\node[name intersections = {of = soi and hyper}] (P4) at
($(intersection-2)$) {};

\draw[-latex] (P4.center) -- +(1.5, 0) node[font = \tiny, below left]
{\(\mathbf{V}\)} coordinate (P5);
\draw (P5) -- +(.5, 0) coordinate (P6);

\path[name path global = circ] (P4.center) circle[radius = 1bp];
\path[name intersections = {of = circ and hyper}] (P4.center) --
($(intersection-2)!.75cm!(intersection-1)$) coordinate (P7);

\draw[-latex] (P5) -- +($(P7) - (P4)$) node[font = \tiny, right]
{\(\mathbf{v}_{\infty_1}\)} coordinate (P8);
\draw[-latex] (P4.center) -- (P8) node[font = \tiny, fill = white,
inner sep = 0, pos = .65] {\(\mathbf{V}_1^{(v)}\)};

\node[name intersections = {of = soi and hyper}] (P9) at ($(intersection-1)$)
{};

\draw[-latex] (P9.center) -- +(1.5, 0) node[font = \tiny, below left]
{\(\mathbf{V}\)} coordinate (P10);
\draw (P10) -- +(.65, 0) coordinate (P11);

\path[name path global = circ2] (P9.center) circle[radius = 1bp];
\path[name intersections = {of = circ2 and hyper}] (P9.center) --
($(intersection-2)!.75cm!(intersection-1)$) coordinate (P12);

\draw[-latex] (P10) -- +($(P12) - (P9)$) node[font = \tiny, right]
{\(\mathbf{v}_{\infty_2}\)} coordinate (P13);
\draw[-latex] (P9.center) -- (P13) node[font = \tiny, fill = white,
inner sep = 0, pos = .5, above = .1cm] {\(\mathbf{V}_2^{(v)}\)};

\draw[fixed point arithmetic] let
\p0 = (P4.center),
\p1 = (P5),
\p2 = (P8),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.5cm},
\n4 = {(\n1 + \n2) / 2}
in (P4.center) +(\n1:\n3) arc[radius = \n3, start angle = \n1,
end angle = \n2] node[fill = white, inner sep = 0, font = \tiny] at
([shift = (P4.center)] \n4:.75cm) {\(\alpha_1\)};

\draw[fixed point arithmetic] let
\p0 = (P5),
\p1 = (P6),
\p2 = (P8),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.45cm},
\n4 = {(\n1 + \n2) / 2}
in (P5) +(\n1:\n3) arc[radius = \n3, start angle = \n1,
end angle = \n2] node[fill = white, inner sep = 0, font = \tiny] at
([shift = (P5)] \n4:.63cm) {\(\phi_1\)};

\draw[fixed point arithmetic] let
\p0 = (P9.center),
\p1 = (P10),
\p2 = (P13),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.5cm},
\n4 = {(\n1 + \n2) / 2}
in (P9.center) +(\n1:\n3) arc[radius = \n3, start angle = \n1,
end angle = \n2];

\draw[fixed point arithmetic] let
\p0 = (P10),
\p1 = (P11),
\p2 = (P13),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.65cm},
\n4 = {(\n1 + \n2) / 2}
in (P10) +(\n1:\n3) arc[radius = \n3, start angle = \n1,
end angle = \n2] node[fill = white, inner sep = 0, font = \tiny] at
([shift = (P10)] \n4:\n3) {\(\phi_2\)};

\begin{scope}[on background layer]
\draw[dashed] (O) -- +($(O) - 0.65*(I)$) coordinate (P14);
\end{scope}

\draw[latex-] (P14) -- +($(P4) - (P7)$) node[font = \tiny, right]
{\(\mathbf{v}_{\infty_1}\)} coordinate (P15);
\draw[-latex] (P15) -- +($(P12) - (P9)$) node[font = \tiny, below]
{\(\mathbf{v}_{\infty_2}\)} coordinate (P16);
\draw[-latex] (P14) -- (P16) node[font = \tiny, pos = .5, above]
{\(\Delta\mathbf{V}^{(v)}\)};

\draw let
\p0 = (P15),
\p1 = (P14),
\p2 = (P16),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {.25cm},
\n4 = {(\n1 + \n2) / 2}
in (P15) +(\n1:\n3) arc[radius = \n3, start angle = \n1,
end angle = \n2] node[inner sep = 0, font = \tiny, inner sep = 0,
fill = white] at ([shift = (P15)] \n4:\n3) {\(\delta\)};

\draw (-2.32, 2.15) arc[radius = .25cm, start angle = 90, end angle = -90]
node[left, font = \tiny] {\(\alpha_2\)};
\end{tikzpicture}
\end{document}
[/LATEXS]

 
Last edited: