我想绘制这个坐标系,但是我遇到了太多麻烦。我已经从这个例子中获得了基础知识:http://www.texample.net/media/tikz/examples/TEX/the-3dplot-package.tex 但是我无法将角度 alpha 2 调整到正确的位置。有人能告诉我怎么做吗?
\documentclass{article}
%%%<
\usepackage{verbatim}
\usepackage{esvect}
%%%>
\usepackage{tikz} %TikZ is required for this to work. Make sure this exists before the next line
\usepackage{3dplot} %requires 3dplot.sty to be in same directory, or in your LaTeX installation
\usepackage[active,tightpage]{preview} %generates a tightly fitting border around the work
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{2mm}
\begin{document}
%Angle Definitions
%-----------------
%set the plot display orientation
%synatax: \tdplotsetdisplay{\theta_d}{\phi_d}
\tdplotsetmaincoords{60}{110}
%define polar coordinates for some vector
%TODO: look into using 3d spherical coordinate system
\pgfmathsetmacro{\rvec}{1}
\pgfmathsetmacro{\thetavec}{50}
\pgfmathsetmacro{\phivec}{55}
%start tikz picture, and use the tdplot_main_coords style to implement the display
%coordinate transformation provided by 3dplot
\begin{tikzpicture}[scale=5,tdplot_main_coords]
%set up some coordinates
%-----------------------
\coordinate (O) at (0,0,0);
%determine a coordinate (P) using (r,\theta,\phi) coordinates. This command
%also determines (Pxy), (Pxz), and (Pyz): the xy-, xz-, and yz-projections
%of the point (P).
%syntax: \tdplotsetcoord{Coordinate name without parentheses}{r}{\theta}{\phi}
\tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}
%draw figure contents
%--------------------
%draw the main coordinate system axes
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$x$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$y$};
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$z$};
\draw[thick,->] (0,0,0) -- (Py) node[anchor=north west]{$a_x$};
\draw[thick,->] (0,0,0) -- (Px) node[anchor=east]{$a_z$};
\draw[thick,->] (0,0,0) -- (Pz) node[anchor= east]{$a_y$};
%draw a vector from origin to point (P)
\draw[-stealth,color=red] (O) -- (P) node[above, right]{$\vv{a}$};
%draw projection on xy plane, and a connecting line
\draw[dashed, color=red] (O) -- (Pxy)node[midway, left]{$w$};
\draw[dotted] (P) -- (Pxy);
\draw[dashed, color=red] (P) -- (Pz);
\draw[dotted] (Pxy) -- (Py);
\draw[dotted] (Pxy) -- (Px);
%draw the angle \phi, and label it
%syntax: \tdplotdrawarc[coordinate frame, draw options]{center point}{r}{angle}{label options}{label}
\tdplotdrawarc{(O)}{0.22}{0}{\phivec}{anchor=south}{$\alpha_1$}
%set the rotated coordinate system so the x'-y' plane lies within the
%"theta plane" of the main coordinate system
%syntax: \tdplotsetthetaplanecoords{\phi}
\tdplotsetthetaplanecoords{\phivec}
%draw theta arc and label, using rotated coordinate system
\tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.22}{0}{\thetavec}{anchor=west}{$\alpha_2$}
\end{tikzpicture}
\end{document}