tikz-3dplot 中的导航系统坐标

tikz-3dplot 中的导航系统坐标

我正在使用 tikz-3dplot 并尝试表示导航系统变换。在导航系统中,车辆轴的方向以侧倾、俯仰和偏航表示。这些通常表示为 Phi、Theta 和 Psi 的欧拉角。

我试图表达以下内容:

绕 Z 轴旋转 Psi,即偏航角。然后绕新的 Y 轴旋转俯仰角 (Theta)。然后绕新的 X 轴旋转滚动角 (Phi)。

我遇到的挑战是 Tikz-3dplot 绕 Z、Y 然后 Z 轴旋转。根据文档,这些旋转应该相对于“世界”Z、Y 和 Z 轴。在阅读了欧拉角(在维基百科上)后,我了解到欧拉角实际上有多种表示形式,Z、Y、Z 就是其中一种,我熟悉的 Z、Y、X 也是如此。

我现在遇到的问题是,当我应用 tikz-3dplot 命令时: \tdplotsetrotatedcoords{\psi}{\theta}{\phi}第一次旋转围绕 Z 轴,正如预期的那样。第二次旋转(\theta),围绕旋转的 Y 轴,这确实是我想要的,但不是文档所声称的。不幸的是,我被困在这里。最后的旋转需要围绕旋转的 X 轴,但实际上围绕旋转的 Z 轴旋转...

如果旋转是围绕世界轴的,我可以想出一个变换(虽然我真的必须考虑一下)..但是,由于它们不是,我完全不知道如何获得最终的旋转系统...

我一直在寻找答案,但得到的答案却很少。我甚至尝试修改 tikz-3dplot 包,制作自己的副本。这可能有效,但我希望有更好的答案,因为我真的没有时间学习足够的 tex 知识来做到这一点,也没有时间对其进行故障排除。


使搜索引擎更容易发现的关键字:

zyz 序列、zyx 序列、旋转序列

答案1

这是一个宏\tdseteulerxyz,它设置欧拉矩阵使用 XYZ(偏航-俯仰-滚转)顺序进行旋转。矩阵取自维基百科,您还可以在其中找到其他旋转顺序的矩阵。请注意,这与 tikz-3dplot 通常使用其参数的方式相反\tdplotsetrotatedcoords;第一个参数是 roll,最后一个是 yaw。

\tdseteulerxyz这是两张 tikz-3dplot 图片,除了在第二张图片之前调用之外,其余完全相同。

代码如下:

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

\begin{document}

\newcommand{\tdseteulerxyz}{
\renewcommand{\tdplotcalctransformrotmain}{%
%perform some trig for the Euler transformation
\tdplotsinandcos{\sinalpha}{\cosalpha}{\tdplotalpha} 
\tdplotsinandcos{\sinbeta}{\cosbeta}{\tdplotbeta}
\tdplotsinandcos{\singamma}{\cosgamma}{\tdplotgamma}
%
\tdplotmult{\sasb}{\sinalpha}{\sinbeta}
\tdplotmult{\sasg}{\sinalpha}{\singamma}
\tdplotmult{\sasbsg}{\sasb}{\singamma}
%
\tdplotmult{\sacb}{\sinalpha}{\cosbeta}
\tdplotmult{\sacg}{\sinalpha}{\cosgamma}
\tdplotmult{\sasbcg}{\sasb}{\cosgamma}
%
\tdplotmult{\casb}{\cosalpha}{\sinbeta}
\tdplotmult{\cacb}{\cosalpha}{\cosbeta}
\tdplotmult{\cacg}{\cosalpha}{\cosgamma}
\tdplotmult{\casg}{\cosalpha}{\singamma}
%
\tdplotmult{\cbsg}{\cosbeta}{\singamma}
\tdplotmult{\cbcg}{\cosbeta}{\cosgamma}
%
\tdplotmult{\casbsg}{\casb}{\singamma}
\tdplotmult{\casbcg}{\casb}{\cosgamma}
%
%determine rotation matrix elements for Euler transformation
\pgfmathsetmacro{\raaeul}{\cacb}
\pgfmathsetmacro{\rabeul}{\casbsg - \sacg}
\pgfmathsetmacro{\raceul}{\sasg + \casbcg}
\pgfmathsetmacro{\rbaeul}{\sacb}
\pgfmathsetmacro{\rbbeul}{\sasbsg + \cacg}
\pgfmathsetmacro{\rbceul}{\sasbcg - \casg}
\pgfmathsetmacro{\rcaeul}{-\sinbeta}
\pgfmathsetmacro{\rcbeul}{\cbsg}
\pgfmathsetmacro{\rcceul}{\cbcg}
}
}

\tdplotsetmaincoords{60}{110}
\tdseteulerxyz
\begin{tikzpicture}[tdplot_main_coords]
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\tdplotsetrotatedcoords{30}{30}{30}
\draw[thick,color=blue,tdplot_rotated_coords,->] (0,0,0) --
(.7,0,0) node[anchor=north]{$x'$};
\draw[thick,color=blue,tdplot_rotated_coords,->] (0,0,0) --
(0,.7,0) node[anchor=west]{$y'$};
\draw[thick,color=blue,tdplot_rotated_coords,->] (0,0,0) --
(0,0,.7) node[anchor=south]{$z'$};
\end{tikzpicture}

\end{document}

相关内容