在使用 Tikz 包绘制天球,他们使用pspicture
。有没有办法pspicture
在 内使用tikz
?我想要一条双曲线经过地球,其近点为 500 公里(当然是按纸面比例缩放的)。
\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}
答案1
这是一个解决方案,没有为地球绘制花哨的图画,但它显示了地球沿双曲线轨道运行时太阳辐射的变化。
注:有椭圆形版本可供选择这里。
\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{\Sunradius}{0.2} % Sun radius
\pgfmathsetmacro{\Earthradius}{0.05} % Earth radius
\pgfmathsetmacro{\thetamax}{1.5}
\draw plot[domain = -\thetamax:\thetamax] ({\a*cosh(\x)}, {\b*sinh(\x)});
\draw (\c,0) circle (1pt);
\shade[%
top color=yellow!70,%
bottom color=red!70,%
shading angle={45},%
] (\c,0) circle (\Sunradius);
% 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)}
\pgfmathsetmacro{\radiation}{100*(1-\c)/d(\theta))^2}
\colorlet{Earthlight}{yellow!\radiation!blue}
\shade[
top color=Earthlight,
bottom color=blue,
shading angle={90+f(\theta)},
] ({\a*cosh(\theta)}, {\b*sinh(\theta)}) circle (\Earthradius);
}
\end{tikzpicture}
\end{center}
\end{document}
编辑:以地球的漂亮 .png 为焦点。
我使用的图片改编自发布的图片那里。
\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{\Earthradius}{0.1} % Earth radius
\pgfmathsetmacro{\UFOradius}{.03}
\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)}
\shade[top color=black,bottom color=gray]
({\a*cosh(\theta)}, {\b*sinh(\theta)}) circle (\UFOradius);
}
\end{tikzpicture}
\end{center}
\end{document}