我正在尝试创建一些 tikz 图形来说明不同的地球参考系。我使用的代码灵感来自这:
\tdplotsetmaincoords{60}{110}
%
\pgfmathsetmacro{\rvec}{.8}
\pgfmathsetmacro{\thetavec}{45}
\pgfmathsetmacro{\phivec}{50}
%
\definecolor{darkgreen}{rgb}{0.1,0.7,0.1}
\begin{tikzpicture}[scale=5,tdplot_main_coords]
\coordinate (O) at (0,0,0);
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$X{\text{ecef}}$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$Y_{\text{ecef}}$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$Z_{\text{ecef}}$};
\tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}
\tdplotdrawarc[blue]{(O)}{0.8}{-90}{90}{}{}
\tdplotdrawarc[dashed,blue]{(O)}{0.8}{90}{270}{}{}
%
\tdplotsetthetaplanecoords{\phivec}
%
\tdplotsetthetaplanecoords{0}
\tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.8}{0}{90}{left}{\rotatebox[origin=cc]{85}{Prime Meridian}}
\tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.8}{90}{180}{}{}
%
\tdplotsetthetaplanecoords{90}
\tdplotdrawarc[tdplot_rotated_coords,blue]{(0,0,0)}{0.8}
{0}{360}{}{}
%
\end{tikzpicture}
除了本初子午线和南极相交的地方有点奇怪之外,一切看上去都很好。
x 轴有点太“超出屏幕”了,我不喜欢,但当我使用{60}{110}
它时,它看起来像
交叉点看起来有点不对劲。也许我的预期是错误的,但这个视角看起来像一个非常扭曲的圆圈,这真的不是我所期望的。特别是考虑到 tikz 是相对于旋转和参考系编写的,所以我认为不同的视角不应该有太大变化。
我不太确定哪里出了问题或者我是否有错误的期望,但我正试图解决这个问题,以便后一个视角不会显示出如此扭曲的球体。
答案1
以下是使用非官方的示例circleofsphere 包。
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot-circleofsphere}
\begin{document}
\definecolor{darkgreen}{rgb}{0.1,0.7,0.1}
\tdplotsetmaincoords{60}{110}
\begin{tikzpicture}[scale=5,tdplot_main_coords,thick,>=stealth]
%
\pgfmathsetmacro{\rvec}{.8}
\pgfmathsetmacro{\thetavec}{45}
\pgfmathsetmacro{\phivec}{50}
%
\coordinate (O) at (0,0,0);
\draw (O) -- (\rvec,0,0);
\draw (O) -- (0,\rvec,0);
\draw (O) -- (0,0,\rvec);
\path[tdplot_screen_coords,ball color=gray,opacity=0.9] (O) circle[radius=\rvec];
\begin{scope}[blue]
\tdplotCsDrawLatCircle{\rvec}{0}
\tdplotCsDrawLonCircle{\rvec}{90}
\end{scope}
\draw[thick,->] (\rvec,0,0) -- (1,0,0) node[anchor=north east]{$X_\mathrm{ecef}$};
\draw[thick,->] (0,\rvec,0) -- (0,1,0) node[anchor=north west]{$Y_\mathrm{ecef}$};
\draw[thick,->] (0,0,\rvec) -- (0,0,1) node[anchor=south]{$Z_\mathrm{ecef}$};
%
\end{tikzpicture}
\end{document}
如果您希望注释这些弧,我推荐decorations.text
。
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot-circleofsphere}
\usetikzlibrary{decorations.text}
\begin{document}
\definecolor{darkgreen}{rgb}{0.1,0.7,0.1}
\tdplotsetmaincoords{60}{110}
\begin{tikzpicture}[scale=5,tdplot_main_coords,thick,>=stealth]
%
\pgfmathsetmacro{\rvec}{.8}
\pgfmathsetmacro{\thetavec}{45}
\pgfmathsetmacro{\phivec}{50}
%
\coordinate (O) at (0,0,0);
\draw (O) -- (\rvec,0,0);
\draw (O) -- (0,\rvec,0);
\draw (O) -- (0,0,\rvec);
\begin{scope}[blue,tdplotCsFront/.style={draw=none}]
\tdplotCsDrawLatCircle{\rvec}{0}
\tdplotCsDrawLonCircle{\rvec}{90}
\end{scope}
\path[tdplot_screen_coords,ball color=gray,opacity=0.9] (O) circle[radius=\rvec];
\begin{scope}[blue,tdplotCsBack/.style={draw=none}]
\tdplotCsDrawLatCircle{\rvec}{0}
\tdplotCsDrawLonCircle{\rvec}{90}
\draw[decoration={text along path,text={|\sffamily\large\color{blue}|Equator},raise=3pt},
decorate] plot[variable=\t,domain=10:80]
({\rvec*cos(\t)},{\rvec*sin(\t)},0);
\draw[decoration={text along path,text={|\sffamily\large\color{blue}|Prime Meridian},raise=3pt},
decorate] plot[variable=\t,domain=10:80]
({\rvec*cos(\t)},0,{\rvec*sin(\t)});
\end{scope}
\draw[thick,->] (\rvec,0,0) -- (1,0,0) node[anchor=north east]{$X_\mathrm{ecef}$};
\draw[thick,->] (0,\rvec,0) -- (0,1,0) node[anchor=north west]{$Y_\mathrm{ecef}$};
\draw[thick,->] (0,0,\rvec) -- (0,0,1) node[anchor=south]{$Z_\mathrm{ecef}$};
%
\end{tikzpicture}
\end{document}