我正在尝试绘制一张像附件中的图片。我没有使用过很多软件包tikz
。到目前为止,我的代码如下。我想在图像中包含一组角度。任何帮助都很好,如果有人知道一个好的 pdf 或书籍可以介绍软件包的基础知识,tikz
那就太好了。
\documentclass[twoside,12pt,a4paper]{report}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{center}
\begin{tikzpicture}
%draw of base circles and ellipse's
\draw(0,0,0) circle (2.0);
\draw (0,0,0) ellipse (2.0 and 0.3);
\draw (0,0,0) ellipse (0.75 and 2.0);
%drawing of the Earth-Centered-Earth_Fixed (ECEF) Frame
\draw[thick,->] (0,0,0) -- (2.3,0,0) node[right,anchor=north east,right]{$e_x$};
\draw[thick,->] (0,0,0) -- (0,2.3,0) node[anchor=north west,above]{$e_z$};
\draw[thick,->] (0,0,0) -- (0,0.71,3) node[anchor=south,left]{$e_y$};
\end{tikzpicture}
\end{center}
\end{document}
答案1
这是通过 解决的tikz-3dplot
。人们可能想尝试不同的视角\tdplotsetmaincoords{75}{95}
,比如 (85,90) (85,100) (75,100) 来观看 3D 效果。
代码
\documentclass[border=10pt]{standalone}
\usepackage{tikz,amsmath}
\usepackage{tikz-3dplot}
\usetikzlibrary{shapes,calc,positioning}
\begin{document}
\tdplotsetmaincoords{75}{95}
%
\pgfmathsetmacro{\rvec}{.8}
\pgfmathsetmacro{\thetavec}{40}
\pgfmathsetmacro{\phivec}{35}
%
\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{ecdf}}$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$Z_{\text{ecef}}$};
\tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}
\draw[-stealth,color=red] (O) -- (P);
\draw[dashed, color=red, shorten >=-20pt ] (O) -- (Pxy);
\tdplotdrawarc{(O)}{0.4}{0}{\phivec}{anchor=north}{$\lambda$}
\tdplotdrawarc[blue]{(O)}{0.8}{-90}{90}{}{}
\tdplotdrawarc[dashed,blue]{(O)}{0.8}{90}{270}{}{}
%
\tdplotsetthetaplanecoords{\phivec}
\tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.5}{\thetavec}%
{90}{right}{$\phi$}
\tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.8}
{0}{90}{}{}
%
\tdplotsetthetaplanecoords{0}
\tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.8}{0}{90}{left}{\rotatebox[origin=cc]{85}{Prime Meridian}}
%
\tdplotsetthetaplanecoords{90}
\tdplotdrawarc[tdplot_rotated_coords,blue]{(0,0,0)}{0.8}
{0}{360}{}{}
%
\tdplotsetrotatedcoords{\phivec}{\thetavec}{0}
\tdplotsetrotatedcoordsorigin{(P)}
\draw[thick,tdplot_rotated_coords,-,draw=green,fill=white] (-0.1,-0.1,0)
-- (-0.1,0.1,0) -- (0.1,0.1,0) -- (0.1,-0.1,0) -- cycle ;
\draw[thick,tdplot_rotated_coords,->,green] (0,0,0)
-- (-0.5,0,0) node[anchor=west]{$North$};
\draw[thick,tdplot_rotated_coords,->,green] (0,0,0)
-- (0,0.5,0) node[anchor=south]{$East$};
\draw[thick,tdplot_rotated_coords,->,green] (0,0,0)
-- (0,0,0.5) node[anchor=south]{$Up$};
\end{tikzpicture}
\end{document}