오일러 각도를 사용하여 최종 회전을 수행하고 싶습니다. 이 링크에서오일러 각도, 최종 회전은 프레임 (x,y,z)에서 시작하여 (x',y',z')를 거쳐 (x'',y'',z'')를 거쳐 마지막으로 끝나는 세 번의 연속 회전을 거칩니다. 프레임(x''',y''',z''')이 있습니다. 나는 이것을 본 적이 있다우편그리고 그것은 나에게 어느 정도 도움이 되었습니다. 내 경우에는 첫 번째 회전이 산출됩니다.
두 번째 회전은 다음을 산출합니다.
이제 세 번째 회전에서는 앞서 언급한 링크의 결과가 나오지 않습니다.
x2, x3은 같은 방향을 가리켜야 합니다.
이것은 코드입니다
\documentclass[preview,varwidth ,multi,border=3pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{1cm}
\begin{document}
\tdplotsetmaincoords{70}{100}
\begin{tikzpicture}[scale=5,tdplot_main_coords]
\coordinate (O) at (0,0,0);
% main Frame (x,y,z)
\draw[thick,->,line width=0.55mm] (O) -- (2.0,0,0) node[anchor=north west]{$X$};
\draw[thick,->,line width=0.55mm] (O) -- (0,2.0,0) node[anchor=west] {$Y$};
\draw[thick,->,line width=0.55mm] (O) -- (0,0,2.0) node[anchor=south] {$Z$};
% define yaw, pitch, and roll
\def \yaw {30}
\def \roll {30}
\def \pitch {30}
%_____________________________________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%( Yaw )%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% First rotation yields Frame 1 (about z axis main)
% Frame 1 (x1,y1, z1)
\tdplotsetrotatedcoords{\yaw}{0}{0}
\draw[thick,->,line width=0.65mm, color=red, tdplot_rotated_coords]
(O) -- (1.5,0,0) node[xshift=0mm,anchor=north west] {$x^{1}$};
\draw[thick,->,line width=0.65mm, color=red, tdplot_rotated_coords]
(O) -- (0,1.5,0) node[anchor=west]{$y^{1}$};
\draw[thick,->,line width=0.65mm, color=red, tdplot_rotated_coords]
(O) -- (0,0,1.5) node[anchor=south,xshift=3mm, yshift=-1mm]{$z^{1}$};
%_____________________________________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%( Pitch )%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Second rotation yields Frame 2 (about y1 axis)
% Frame 2 (x2,y2, z2)
\tdplotsetrotatedcoords{\yaw}{\pitch}{0}
\draw[thick,->,line width=0.65mm, color=blue, tdplot_rotated_coords]
(O) -- (1.0,0,0) node[xshift=0mm,anchor=north west]{$x^{2}$};
\draw[thick,->,line width=0.65mm, color=blue,tdplot_rotated_coords]
(O) -- (0,1.0,0) node[anchor=west]{$y^{2}$};
\draw[thick,->,line width=0.65mm, color=blue,tdplot_rotated_coords]
(O) -- (0,0,1.0) node[anchor=south,xshift=3mm, yshift=-1mm]{$z^{2}$};
%_____________________________________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%( Roll )%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Third rotation yields Frame 3 (about x2 axis) <-- (it should be )
% Frame 3 (x3,y3,z3)
\tdplotsetrotatedcoords{\yaw}{\pitch}{\roll}
\draw[thick,->,line width=0.65mm, color=green, tdplot_rotated_coords]
(O) -- (0.5,0,0) node[xshift=0mm,anchor=north west]{$x^{3}$};
\draw[thick,->,line width=0.65mm, color=green,tdplot_rotated_coords]
(O) -- (0,0.5,0) node[anchor=west]{$y^{3}$};
\draw[thick,->,line width=0.65mm, color=green,tdplot_rotated_coords]
(O) -- (0,0,.5) node[anchor=south]{$z^{3}$};
\end{tikzpicture}
\end{document}
답변1
내 생각에 이것은 다음과 중복될 수 있습니다.tikz-3dplot의 내비게이션 시스템 좌표: 기본적으로 tikz-3dplot
회전 시퀀스 ZYZ를 사용합니다(즉, 먼저 Z축을 중심으로 회전한 다음 새 Y축 Y'를 중심으로 회전한 다음 새 Z축 Z''를 중심으로 회전). 사용자는 회전 시퀀스 ZYX를 원합니다. 이를 위해서는 변환 매개변수를 재정의해야 합니다.
\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}
}
}
그런 다음 를 사용하여 새 회전 시퀀스를 활성화할 수 있습니다 \tdseteulerxyz
.
전체 코드는 다음과 같습니다.
\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\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}
}
}
\begin{document}
\tdseteulerxyz
\tdplotsetmaincoords{70}{100}
\begin{tikzpicture}[scale=5,tdplot_main_coords]
\coordinate (O) at (0,0,0);
% main Frame (x,y,z)
\draw[thick,->,line width=0.55mm] (O) -- (2.0,0,0) node[anchor=north west]{$X$};
\draw[thick,->,line width=0.55mm] (O) -- (0,2.0,0) node[anchor=west] {$Y$};
\draw[thick,->,line width=0.55mm] (O) -- (0,0,2.0) node[anchor=south] {$Z$};
% define yaw, pitch, and roll
\def \yaw {30}
\def \roll {30}
\def \pitch {30}
%_____________________________________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%( Yaw )%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% First rotation yields Frame 1 (about z axis main)
% Frame 1 (x1,y1, z1)
\tdplotsetrotatedcoords{\yaw}{0}{0}
\draw[thick,->,line width=0.65mm, color=red, tdplot_rotated_coords]
(O) -- (1.5,0,0) node[xshift=0mm,anchor=north west] {$x^{1}$};
\draw[thick,->,line width=0.65mm, color=red, tdplot_rotated_coords]
(O) -- (0,1.5,0) node[anchor=west]{$y^{1}$};
\draw[thick,->,line width=0.65mm, color=red, tdplot_rotated_coords]
(O) -- (0,0,1.5) node[anchor=south,xshift=3mm, yshift=-1mm]{$z^{1}$};
%_____________________________________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%( Pitch )%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Second rotation yields Frame 2 (about y1 axis)
% Frame 2 (x2,y2, z2)
\tdplotsetrotatedcoords{\yaw}{\pitch}{0}
\draw[thick,->,line width=0.65mm, color=blue, tdplot_rotated_coords]
(O) -- (1.0,0,0) node[xshift=0mm,anchor=north west]{$x^{2}$};
\draw[thick,->,line width=0.65mm, color=blue,tdplot_rotated_coords]
(O) -- (0,1.0,0) node[anchor=west]{$y^{2}$};
\draw[thick,->,line width=0.65mm, color=blue,tdplot_rotated_coords]
(O) -- (0,0,1.0) node[anchor=south,xshift=3mm, yshift=-1mm]{$z^{2}$};
%_____________________________________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%( Roll )%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Third rotation yields Frame 3 (about x2 axis) <-- (it should be )
% Frame 3 (x3,y3,z3)
\tdplotsetrotatedcoords{\yaw}{\pitch}{\roll}
\draw[thick,->,line width=0.65mm, color=green, tdplot_rotated_coords]
(O) -- (0.5,0,0) node[xshift=0mm,anchor=north west]{$x^{3}$};
\draw[thick,->,line width=0.65mm, color=green,tdplot_rotated_coords]
(O) -- (0,0.5,0) node[anchor=west]{$y^{3}$};
\draw[thick,->,line width=0.65mm, color=green,tdplot_rotated_coords]
(O) -- (0,0,.5) node[anchor=south]{$z^{3}$};
\end{tikzpicture}
\end{document}