我尝试了第一个图形旋转,结果非常酷:
它的代码如下:
\documentclass[tikz,border=10mm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{tikz-3dplot}
\pgfplotsset{compat=1.18}
\usetikzlibrary{arrows.meta, shapes.geometric, positioning, perspective, patterns.meta, decorations.pathreplacing, decorations.pathmorphing, patterns, snakes, arrows, shapes, decorations.text, angles, quotes,calc, 3d, decorations.markings, math, circuits.ee.IEC}
\usepackage{circuitikz}
\begin{document}
\definecolor{jack}{HTML}{380036}
\definecolor{back}{HTML}{0CBABA}
\tdplotsetmaincoords{75}{130}
\begin{tikzpicture}[>=stealth, tdplot_main_coords, scale=2]
\draw[->, thick, back] (0,0,0)--(2,0,0) node[above] {$\vec{x}$};
\draw[->, thick, back] (0,0,0)--(0,2,0) node[above] {$\vec{y}$};
\draw[->, thick, back] (0,0,0)--(0,0,2) node[above] {$\vec{z}$};
\tdplotsetrotatedcoords{40}{0}{0}
\tdplotdrawarc[tdplot_rotated_coords,circle, dashed, fill=back!30, opacity=0.3]{(0,0,0)}{2}{0}{360}{}{}
\draw[tdplot_rotated_coords, thick, jack, ->] (0,0,0)--(2,0,0) node[anchor=north east]{$\vec{u}$};
\draw[tdplot_rotated_coords, thick, jack, ->] (0,0,0)--(0,2,0) node[anchor=west]{$\vec{v}$};
\tdplotdrawarc[tdplot_rotated_coords,jack]{(0,0,0)}{0.7}{-40}{0}{anchor=north east}{$\psi$}
\tdplotdrawarc[tdplot_rotated_coords,jack]{(0,0,0)}{0.7}{90-40}{90}{anchor=west}{$\psi$}
\tdplotdrawarc[->,color=jack!75,thick]{(0,0,1.75)}{0.2}{0}{310}{anchor=south west,color=jack!75}{Précession $\psi$}
\end{tikzpicture}
\end{document}
问题是当我尝试绕新轴“u”进行第二次旋转时,根据设置时获得的定义:\tdplotsetrotatedcoords{40}{0}{40}
因为该命令的第一个参数是绕 z 轴的旋转,第二个参数是绕 y 轴的旋转,第三个参数是绕 x 轴的旋转,当我尝试这样做时没有任何变化,所以有没有什么方法可以表示这种旋转(请注意,我还没有完全阅读文档)。
有什么想法吗?提前致谢!
答案1
我正在使用3d
和perspective
Ti钾为此,我创建了 Z 库。我还创建了三种样式:
axis
,如果需要,可以更改轴样式。绘图的大部分都是轴,因此我们避免逐个更改它们。my view
,只需同时更改所有图像中的视图即可。nutation
,从而根据‘章动’角度改变轴。
这样,我们只需要几个scope
s,每个图像一个,还有一个用于中心图像(“章动”部分)。
这是我的代码:
\usetikzlibrary{3d,perspective}
\tikzset
{
axis/.style={thick,-latex},
my view/.style={3d view={65}{20}},
nutation/.style={rotate around x=\nut}
}
\colorlet{my cyan}{cyan!50}
\colorlet{my magenta}{magenta!50!pink}
\begin{document}
\begin{tikzpicture}[line cap=round]
\def\pre{-30} % précession
\def\nut{40} % nutation
\def\rop{30} % rotation propre
% left
\begin{scope}[shift={(-7,0)},my view]
\draw[fill=my cyan] (0,0) circle (2);
\draw[axis] (0,0,0) -- (4,0,0) node[below] {$\vec x_1$};
\draw[axis] (0,0,0) -- (0,4,0) node[right] {$\vec y_1$};
\draw[axis] (0,0,0) -- (0,0,4) node[above] {$\vec z_f=\vec z_1$};
\draw[axis] (0,0,0) -- (\pre:4) node[below] {$\vec x_f$};
\draw[axis] (0,0,0) -- (90+\pre:4) node[below] {$\vec y_f$};
\foreach\i in {0,90}
\draw[-latex] (\i+\pre:2.5) arc (\i+\pre:\i:2.5)
node at (\i+0.5*\pre:3) {$\psi$};
\draw[canvas is xy plane at z=2,->] (90:0.5) arc (90:360:0.5) node[pos=0,right] {Précession $\psi$};
\end{scope}
% center
\begin{scope}[my view]
\draw[fill=my magenta,nutation] (2,0) arc (0:-180:2) -- cycle;
\draw[fill=my cyan] (0,0) circle (2);
\draw[axis] (0,0,0) -- (0,4,0) node[right] {$\vec y_1$};
\begin{scope}[nutation]
\draw[fill=my magenta] (2,0) arc (0:180:2) -- cycle;
\draw[axis] (0,0,0) -- (0,4,0) node[above] {$\vec y_2$};
\draw[axis] (0,0,0) -- (0,0,4) node[above] {$\vec z_2$};
\end{scope}
\foreach\i in {0,90}
\draw[my view,canvas is yz plane at x=0,-latex] (\i:2.5) arc (\i:\i+\nut:2.5)
node at (\i+0.5*\nut:3) {$\theta$};
\draw[axis] (0,0,0) -- (4,0,0) node[below] {$\vec x_1=\vec x_2$};
\draw[axis] (0,0,0) -- (0,0,4) node[above] {$\vec z_1$};
\draw[canvas is yz plane at x=2,->] (-90:0.5) arc (-90:170:0.5) node[pos=0.3,right] {Nutation $\theta$};
\end{scope}
% right
\begin{scope}[shift={(7,0)},my view,nutation]
\draw[fill=my magenta] (0,0) circle (2);
\draw[axis] (0,0,0) -- (4,0,0) node[right] {$\vec x_2$};
\draw[axis] (0,0,0) -- (0,4,0) node[above] {$\vec y_2$};
\draw[axis] (0,0,0) -- (0,0,4) node[above] {$\vec z_2=\vec z_3$};
\draw[axis] (0,0,0) -- (\rop:4) node[right] {$\vec x_3$};
\draw[axis] (0,0,0) -- (90+\rop:4) node[above] {$\vec y_3$};
\foreach\i in {0,90}
\draw[-latex] (\i:2.5) arc (\i:\i+\rop:2.5)
node at (\i+0.5*\rop:3) {$\varphi$};
\draw[canvas is xy plane at z=2,->] (-90:0.5) arc (-90:160:0.5) node[yshift=-4mm,pos=0,text width=2cm] {Rotation propre $\varphi$};
\end{scope}
\end{tikzpicture}
\end{document}
更新 1:第二张图:
\documentclass[tikz,border=2.718mm]{standalone}
\begin{document}
\begin{tikzpicture}[line cap=round]
% axis
\foreach\i in {1,2,3}
{
\begin{scope}[shift={(6*\i,0)}]
\foreach\j in {0,1}
{
\draw[thick,latex-latex,rotate=20*\j] (0,4) coordinate (Y\i\j) |- (4,0) coordinate (X\i\j);
\draw[->] (90*\j:3) arc (90*\j:90*\j+20:3) coordinate[midway] (A\i\j);
}
\draw[fill=white] (0,0) circle (0.2);
\fill (0,0) coordinate (O\i) circle (0.1);
\coordinate (P\i) at (2,3);
\end{scope}
}
% left
\node[yshift=-5mm] at (O1) {\strut$\vec z_f=\vec z_1$};
\node[right] at (X10) {\strut$\vec x_f$};
\node[above] at (Y10) {\strut$\vec y_f$};
\node[right] at (X11) {\strut$\vec x_1$};
\node[above] at (Y11) {\strut$\vec y_1$};
\node[right] at (A10) {\strut$\psi$};
\node[above] at (A11) {\strut$\psi$};
\node at (P1) {\strut Précession};
% center
\node[yshift=-5mm] at (O2) {\strut$\vec x_1=\vec x_2$};
\node[right] at (X20) {\strut$\vec y_1$};
\node[above] at (Y20) {\strut$\vec z_1$};
\node[right] at (X21) {\strut$\vec y_2$};
\node[above] at (Y21) {\strut$\vec z_2$};
\node[right] at (A20) {\strut$\theta$};
\node[above] at (A21) {\strut$\theta$};
\node at (P2) {\strut Nutation};
% right
\node[yshift=-5mm] at (O3) {\strut$\vec z_2=\vec z_1$};
\node[right] at (X30) {\strut$\vec x_2$};
\node[above] at (Y30) {\strut$\vec y_2$};
\node[right] at (X31) {\strut$\vec x_3$};
\node[above] at (Y31) {\strut$\vec y_3$};
\node[right] at (A30) {\strut$\varphi$};
\node[above] at (A31) {\strut$\varphi$};
\node at (P3) {\strut Rotation propre};
\end{tikzpicture}
\end{document}
更新 2:第二张图的第二个版本,使用\pic
(几乎相同的输出):
\tikzset
{%
pics/axis/.style n args={7}{
% #1 = x axis label (without subscript): x,y,z
% #2 = y axis label (without subscript): x,y,z
% #3 = z axis label (without subscript): x,y,z
% #4 = original axis label (subscript)
% #5 = rotated axis label (subscript)
% #6 = angle
% #7 = figure label
code={%
\draw[thick,latex-latex] (0,4) node[above] {\strut$\vec#2_#4$} |- (4,0) node[right] {\strut$\vec#1_#4$};
\draw[thick,latex-latex,rotate=20] (0,4) node[above] {\strut$\vec#2_#5$} |- (4,0) node[right] {\strut$\vec#1_#5$};
\foreach\j in {0,1}
\draw[->] (90*\j:3) arc (90*\j:90*\j+20:3) node at (90*\j+10:3.25) {$#6$};
\draw[fill=white] (0,0) circle (0.2);
\fill (0,0) circle (0.1);
\node at (0,-0.5) {\strut$\vec#3_#4=\vec#3_#5$};
\node at (2,3) {\strut#7};
}}
}
\begin{document}
\begin{tikzpicture}[line cap=round]
\pic at (0,0) {axis={x}{y}{z}{f}{1}{\psi}{Precéssion}};
\pic at (6,0) {axis={y}{z}{x}{1}{2}{\theta}{Nutation}};
\pic at (12,0) {axis={x}{y}{z}{2}{3}{\varphi}{Rotation propre}};
\end{tikzpicture}
\end{document}
答案2
使用“蛮力”的方法在构造上缺乏优雅和灵活性,但却能让你得到你想要的东西。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\radius{2}
\def\rA{0.3}
\def\addAx{1}
\def\nutation{45}
\def\precession{-30}
\begin{scope}[shift={(-3.2*\radius,0)}]
\begin{scope}[rotate around y =-50, rotate around x = -90,rotate around y = 5]
\draw[fill=cyan!50] (0,0) circle (\radius);
\draw[thick, -latex] (0,0,0) -- (0,\radius+\addAx,0) node[above] {$\vec{y_1}$};
\draw[thick, -latex] (0,0) ++(90:\radius+0.4) arc (90:90+\precession:\radius+0.4);
\path (0,0) ++(90:\radius+0.4) arc (90:90+0.5*\precession:\radius+0.4) node[right]{$\psi$};
\draw[thick, -latex] (0,0,0) -- (90+\precession:\radius+\addAx) node[right] {$\vec{y_f}$};
\draw[thick, -latex] (0,0,0) -- (0,0,\radius+\addAx) node[above] {$\vec{z_1}$};
\begin{scope}[shift={(0,0,0.9*\radius)}]
\draw[-latex] (0,0) ++(-150:\rA) arc(-150:150:\rA);
\path (0,0) ++(-150:\rA) arc(-150:90:\rA) node[right]{Precession $\psi$};
\end{scope}
\draw[thick, -latex] (0,0,0) -- (\radius+\addAx,0,0) node[below right] {$\vec{x_1}$};
\begin{scope}[rotate around z = \precession]
\draw[thick, -latex] (0,0,0) -- (\radius+\addAx,0,0) node[below right] {$\vec{x_f}$};
\end{scope}
\draw[thick,latex-] (0,0) ++(\radius+0.4,0,0) arc (0:\precession:\radius+0.4);
\path (0,0) ++(\radius+0.4,0,0) arc (0:0.5*\precession:\radius+0.4) node[below] {$\psi$};
\end{scope}
\end{scope}
\begin{scope}[rotate around y =-50, rotate around x = -90,rotate around y = 5]
\begin{scope}[rotate around x = \nutation]
\draw[fill=magenta!50] (0,0,0) -- (-\radius,0,0 ) arc (180:360:\radius);
\end{scope}
\draw[fill=cyan!50] (0,0) circle (\radius);
\draw[thick, -latex] (0,0,0) -- (0,\radius+0.4,0) node[above] {$\vec{y_1}$};
\begin{scope}[rotate around x = \nutation]
\draw[fill=magenta!50] (0,0,0) -- (\radius,0,0 ) arc (0:180:\radius);
\end{scope}
\draw[thick, -latex] (0,0,0) -- (0,0,\radius+0.4) node[above] {$\vec{z_1}$};
\draw[thick, -latex] (0,0,0) -- (\radius+2.5,0,0) node[below right] {$\vec{x_1} = \vec{x_2}$};
\begin{scope}[shift={(\radius+1,0,0)}]
\begin{scope}[rotate around y=90]
\draw[-latex] (0,0) ++(-90:\rA) arc(-90:180:\rA) -- ++(0,-0.075,0);
\node[right] at (0,\rA,0) {Nutation $\theta$};
\end{scope}
\end{scope}
\begin{scope}[rotate around y=90]
\draw[thick,-latex] (0,0,0) ++(90:\radius+0.1) arc (90:90+\nutation:\radius+0.1);
\path (0,0,0) ++(90:\radius+0.1) arc (90:90+0.5*\nutation:\radius+0.1) node[right] {$\theta$};
\draw[thick,-latex] (0,0,0) ++(180:\radius-0.2) arc (180:180+\nutation:\radius-0.2);
\path (0,0,0) ++(180:\radius-0.2) arc (180:180+0.5*\nutation:\radius-0.2) node[above] {$\theta$};
\draw[thick,-latex] (0,0) -- (180+\nutation:\radius+0.4) node[above] {$\vec{z_2}$};
\draw[thick,-latex] (0,0) -- (90+\nutation:\radius+0.4) node[above] {$\vec{y_2}$};
\end{scope}
\end{scope}
\begin{scope}[shift={(3.2*\radius,0)}]
\begin{scope}[rotate around y =-50, rotate around x = -90,rotate around y = 5]
\begin{scope}[rotate around x = \nutation]
\draw[fill=magenta!50] (0,0) circle (\radius);
\draw[thick, -latex] (0,0,0) -- (0,\radius+1,0) node[above] {$\vec{y_2}$};
\draw[thick, -latex] (0,0) ++(90:\radius+0.4) arc (90:90-\precession:\radius+0.4);
\path (0,0) ++(90:\radius+0.4) arc (90:90-0.5*\precession:\radius+0.4) node[above]{$\varphi$};
\draw[thick, -latex] (0,0,0) -- (90-\precession:\radius+1) node[left] {$\vec{y_f}$};
\draw[thick, -latex] (0,0,0) -- (0,0,\radius+0.4) node[above] {$\vec{z_2}=\vec{z_1}$};
\begin{scope}[shift={(0,0,0.9*\radius)}]
\draw[-latex] (0,0) ++(-150:\rA) arc(-150:150:\rA);
\path (0,0) ++(-90:\rA) node[align=left,below]{Rotation\\propre $\phi$};
\end{scope}
\draw[thick, -latex] (0,0,0) -- (\radius+1,0,0) node[below right] {$\vec{x_2}$};
\begin{scope}[rotate around z = -\precession]
\draw[thick, -latex] (0,0,0) -- (\radius+1,0,0) node[below right] {$\vec{x_f}$};
\end{scope}
\draw[thick,-latex] (0,0) ++(\radius+0.4,0,0) arc (0:-\precession:\radius+0.4);
\path (0,0) ++(\radius+0.4,0,0) arc (0:-0.5*\precession:\radius+0.4) node[right] {$\varphi$};
\end{scope}
\end{scope}
\end{scope}
\end{tikzpicture}
\end{document}