如何旋转 3D 箭头

如何旋转 3D 箭头

如何翻转 y 轴上的 3D 箭头,如图所示,并添加具有极化的垂直箭头。

我从 stack exchange 网站上找到了这个代码。

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}

\begin{document}
% Set the plot display orientation
% Syntax: \tdplotsetdisplay{\theta_d}{\phi_d}
\tdplotsetmaincoords{60}{110}

% Start tikz-picture, and use the tdplot_main_coords style to implement the display 
% coordinate transformation provided by 3dplot.
\begin{tikzpicture}[scale=3,tdplot_main_coords]

% Set origin of main (body) coordinate system
\coordinate (O) at (0,0,0);

% Draw main coordinate system
\draw[blue, thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$1$};
\draw[blue, thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$2$};
\draw[blue, thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$3$}; 

%Draw the arcs on each theta plane
%The first position is obvious since we are in the x-y plane and rotating around the z-axis.
%The anchor already went crazy, north is pointing downwards...
\tdplotdrawarc[->,color=black]{(0,0,0.7)}{0.1}{0}{350}{anchor=south west,color=red}{6}
%We move to the z-x axis
\tdplotsetthetaplanecoords{0}
%Notice you have to tell tiks-3dplot you are now in rotated coords
%Since tikz-3dplot swaps the planes in tdplotsetthetaplanecoords, the former y axis is now the z axis.
\tdplotdrawarc[tdplot_rotated_coords,->,color=black]{(0,0,0.7)}{0.1}{110}{460}{anchor=south west,color=red}{5}
\tdplotsetthetaplanecoords{-90}
%Once again we swaps the planes. I don't know why it's working like this but we turn backwards
%so the arrow turns in the positive direction.
\tdplotdrawarc[tdplot_rotated_coords,->,color=black]{(0,0,0.7)}{0.1}{120}{470}{anchor=south west,color=red}{4}
% If you turn the theta plane  of 90 degrees position and rotation are inverted.
%\tdplotsetthetaplanecoords{90}
%\tdplotdrawarc[tdplot_rotated_coords,->,color=black]{(0,0,-0.7)}{0.1}{470}{120}{anchor=south east,color=black}{roll}
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

像这样:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}

\begin{document}
% Set the plot display orientation
% Syntax: \tdplotsetdisplay{\theta_d}{\phi_d}
\tdplotsetmaincoords{60}{110}

% Start tikz-picture, and use the tdplot_main_coords style to implement the display 
% coordinate transformation provided by 3dplot.
\begin{tikzpicture}[scale=3,tdplot_main_coords]

% Set origin of main (body) coordinate system
\coordinate (O) at (0,0,0);

% Draw main coordinate system
\draw[blue, thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$1$};
\draw[blue, thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$2$};
\draw[blue, thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$3$}; 
\draw[->] (-0.05,-0.5,0.01) -- (-0.05,-0.5,1.01) node[anchor=south]{polarization}; 

%Draw the arcs on each theta plane
%The first position is obvious since we are in the x-y plane and rotating around the z-axis.
%The anchor already went crazy, north is pointing downwards...
\tdplotdrawarc[-,color=black]{(0,0,0.7)}{0.1}{0}{198}{anchor=south west,color=red}{6}
\tdplotdrawarc[->,color=black]{(0,0,0.7)}{0.1}{203}{350}{}{}
%We move to the z-x axis
\tdplotsetthetaplanecoords{0}
%Notice you have to tell tiks-3dplot you are now in rotated coords
%Since tikz-3dplot swaps the planes in tdplotsetthetaplanecoords, the former y axis is now the z axis.
\tdplotdrawarc[tdplot_rotated_coords,<-,color=black]{(0,0,0.7)}{0.1}{90}{236}{}{}
\tdplotdrawarc[tdplot_rotated_coords,-,color=black]{(0,0,0.7)}{0.1}{241}{440}{anchor=south west,color=red}{5}
\tdplotsetthetaplanecoords{-90}
%Once again we swaps the planes. I don't know why it's working like this but we turn backwards
%so the arrow turns in the positive direction.
\tdplotdrawarc[tdplot_rotated_coords,-,color=black]{(0,0,0.7)}{0.1}{120}{147}{}{}
\tdplotdrawarc[tdplot_rotated_coords,->,color=black]{(0,0,0.7)}{0.1}{152}{470}{anchor=south west,color=red}{4}
% If you turn the theta plane  of 90 degrees position and rotation are inverted.
%\tdplotsetthetaplanecoords{90}
%\tdplotdrawarc[tdplot_rotated_coords,->,color=black]{(0,0,-0.7)}{0.1}{470}{120}{anchor=south east,color=black}{roll}
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容