# Drawing a hyperbolic trajectory

In Drawing the Celestial Sphere with Tikz Package, they use pspicture. Is there a way to use pspicture inside of tikz? I want to have a hyberbola pass by the Earth with a periapsis of 500km (scaled to the paper of course).

\documentclass{article}
\usepackage{pst-map3d, tikz, pgf}
\begin{document}

\begin{center}
\begin{tikzpicture}
\pgfmathsetmacro{\e}{1.44022}
\pgfmathsetmacro{\a}{1}
\pgfmathsetmacro{\b}{\a*sqrt((\e)^2 - 1)}
\draw plot[domain = -2:2] ({\a*cosh(\x)}, {\b*sinh(\x)});
\begin{pspicture}(-4,-4)(4,4)
\psset{RotX = -23, RotZ = 30, PHI = 46.5833, THETA = 0.3333,
visibility = false, Decran = 15,
path
= /usr/local/texlive/2012/texmf-dist/tex/generic/pst-geo/data}
\WorldMapThreeD[circles = false, blueEarth = false]
\WorldMapThreeD[circles = false, visibility = true, opacity = 0.7]
\psmeridien[visibility = true]{13.33}
\psparallel[visibility = true]{52.51}
\mapputIIID(13.33,52.51){Berlin}
\psparallel[visibility = true]{0}
\end{pspicture}
\end{tikzpicture}
\end{center}
\end{document}

-
Forgive me, I could not follow "hyberbola pass by the Earth with a periapsis of 500km", it would be better to have a schematic/graphic(atleast hand drawn) to show what you need.BTW pspicture is environment in PSTricks analogous to tikzpicture environment to tikz-pgf. I don't think they can be combined as their workflow is different. But the pdf output from pstricks can be attached to a node in TikZ. – texenthusiast Apr 16 '13 at 5:58
Have you seen this? Perhaps you could adapt it to suit your needs... – Jubobs Apr 16 '13 at 8:58
You could try to put the pspicture in a node. – Ulrike Fischer Apr 16 '13 at 9:25
@texenthusiast how do you put it in a node? – dustin Apr 16 '13 at 11:22
you can mix tikZ and PSTricks in any way as long as you use xelatex or the route latex->dvips->ps2pdf. But why can't you use only PSTricks? – Herbert Apr 16 '13 at 11:43

Here is a solution, without fancy drawing for the Earth, but which shows the varying solar radiation as the Earth travels along the hyperbolic orbit.

Note: an elliptical version is available here.

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{center}
\begin{tikzpicture}[scale=2]
\pgfmathsetmacro{\e}{1.44022}               % eccentricity of the hyperbola
\pgfmathsetmacro{\a}{1}
\pgfmathsetmacro{\b}{\a*sqrt((\e)^2 - 1)}
\pgfmathsetmacro{\c}{sqrt((\a)^2+(\b)^2}    % distance from centre to focus
\pgfmathsetmacro{\thetamax}{1.5}

\draw plot[domain = -\thetamax:\thetamax] ({\a*cosh(\x)}, {\b*sinh(\x)});
\draw (\c,0) circle (1pt);

top color=yellow!70,%
bottom color=red!70,%

% This function computes the direction in which light hits the Earth.
\pgfmathdeclarefunction{f}{1}{%
\pgfmathparse{
((-\c+\a*cosh(#1))<0) * ( 180 + atan( \b*sinh(#1)/(-\c+\a*cosh(#1)) ) )
+
((-\c+\a*cosh(#1))>=0) * ( atan( \b*sinh(#1)/(-\c+\a*cosh(#1)) ) )
}
}

% This function computes the distance between Earth and the Sun,
% which is used to calculate the varying radiation intensity on Earth.
\pgfmathdeclarefunction{d}{1}{%
\pgfmathparse{ sqrt((-\c+\a*cosh(#1))^2+(\b*sinh(#1))^2) }
}

\pgfmathtruncatemacro{\N}{8}  % an even number is best here
\pgfmathsetmacro{\thetaoffset}{.15*\thetamax}
\foreach \k in {0,1,...,\N}{
\pgfmathsetmacro{\theta}{(\thetamax-\thetaoffset)*(2*\k/\N-1)}
top color=Earthlight,
bottom color=blue,

}
\end{tikzpicture}
\end{center}
\end{document}


EDIT: with a nice .png of the Earth at the focus instead.

The picture I used is adapted from the one posted there.

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{center}
\begin{tikzpicture}[scale=2]
\pgfmathsetmacro{\e}{1.44022}               % eccentricity of the hyperbola
\pgfmathsetmacro{\a}{1}
\pgfmathsetmacro{\b}{\a*sqrt((\e)^2 - 1)}
\pgfmathsetmacro{\c}{sqrt((\a)^2+(\b)^2}    % distance from centre to focus
\pgfmathsetmacro{\thetamax}{1.2}

\draw plot[domain = -\thetamax:\thetamax] ({\a*cosh(\x)}, {\b*sinh(\x)});

\path (\c,0) node(a) {\includegraphics[width=.5cm]{earth.png}};

\pgfmathtruncatemacro{\N}{8}  % an even number is best here
\pgfmathsetmacro{\thetaoffset}{.05*\thetamax}
\foreach \k in {0,1,...,\N}{
\pgfmathsetmacro{\theta}{(\thetamax-\thetaoffset)*(2*\k/\N-1)}

@dustin Modify \a, which corresponds to the semi-major axis of the hyperbola. Keep it positive, though. Alternatively, you can decrease the size of both the Earth and the UFO to make everything appear further apart without modifying the trajectory. – Jubobs Apr 16 '13 at 19:50