\documentclass{article}
\usepackage{tikz}
\usepackage{fp}
\usepackage{float}
\usetikzlibrary{calc, arrows}
\begin{document}
\begin{figure*}
\begin{tikzpicture}[fixed point arithmetic]
\pgfmathsetmacro{\d}{1.87529 * 4}
\pgfmathsetmacro{\Ly}{sqrt(3) * 2}
\pgfmathsetmacro{\Lx}{\d / 2}
\pgfmathsetmacro{\per}{1707 / 6378 * 4}
\coordinate (E) at (0, 0);
\coordinate (M) at (\d, 0);
\coordinate (L4) at (\Lx, \Ly);
\draw (E) -- (M);
\draw (E) -- (L4);
\draw (M) -- (L4) node[font = \scriptsize, above] {\(L_4\)};;
\draw[-latex] (E) -- (-45:2cm) node[below = .1cm, font = \scriptsize]
{\(v_r\)} coordinate (P1);
\filldraw[blue, opacity = .7] (E) circle (1cm);
\filldraw[gray, opacity = .7] (M) circle (.3cm);
\filldraw[green] (.7 * \per, 0) circle (.075cm);
\node[font = \scriptsize] at (\Lx + 2, \Ly)
{\((187529, 332900.1652, 0)\)};
\draw[dashed, thick] (E) circle (1.2cm);
\draw[dashed, thick, red] ([shift = (E)] -45:1.2cm) .. controls (3, 1)
and (-4, 5) .. (L4);
\draw let
\p0 = (E),
\p1 = (P1),
\p2 = (M),
\n1 = {atan2(\x1 - \x0, \y1 - \y0)},
\n2 = {atan2(\x2 - \x0, \y2 - \y0)},
\n3 = {2cm},
\n4 = {(\n1 + \n2) / 2}
in (E) + (\n1:\n3) arc[radius = \n3, start angle = \n1, end angle = \n2]
node[fill = white, inner sep = 0cm, font = \scriptsize] at ([shift = (E)]
\n4:\n3) {\(\nu = -\frac{\pi}{4}\)};
\end{tikzpicture}
\end{figure*}
\end{document}
I have tried constructing this curve by using controls
in draw but it didn't quite work out. Maybe there is a better way than this but I don't know.
So the flight path would start at the dotted circle and vector v_r
and end at the location L_4
. In the Python code, I plotted the solution longer than needed.
Here is the current image but the curve I would like to add is picture below:
Edit 2:
So I have constructed a somewhat decent curve but I am hoping someone can help it look a little better still. Also, I have changed the screen shot. Why is the figure not centering and is skewed to the right?
Best Answer
If you draw the bounding box for your
tikzpicture
(after adding\centering
and a test caption):you get:
which shows that the bounding box is centered, but something is contributing to it, besides what actually appears in the drawing. Where does this contribution come from? The answer is: from one of your control points (simply place two visible elements at the coordinates used as control points and you'll see this clearly).
You could interrupt the bounding box:
or choose different control points inside the bounding box; for example:
Here's another possibility with a modification for the curved path: