我正在尝试使用 Tikz 创建与此类似的图像
我编写了这段代码,部分基于以下代码此主题作为
\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\newcommand{\xangle}{7}
\newcommand{\yangle}{137.5}
\newcommand{\zangle}{90}
\newcommand{\xlength}{1}
\newcommand{\ylength}{0.5}
\newcommand{\zlength}{1}
\pgfmathsetmacro{\xx}{\xlength*cos(\xangle)}
\pgfmathsetmacro{\xy}{\xlength*sin(\xangle)}
\pgfmathsetmacro{\yx}{\ylength*cos(\yangle)}
\pgfmathsetmacro{\yy}{\ylength*sin(\yangle)}
\pgfmathsetmacro{\zx}{\zlength*cos(\zangle)}
\pgfmathsetmacro{\zy}{\zlength*sin(\zangle)}
\begin{tikzpicture}
[ x={(\xx cm,\xy cm)},
y={(\yx cm,\yy cm)},
z={(\zx cm,\zy cm)},
]
\draw[dashed] (0,0,0) circle (4.5);
\draw[blue!80!black,->] (240:4.5) -- (240:5.5);
\node[blue!80!black] at (240:5.8) {y};
\draw[green!80!black,->] (240:4.5) -- ++(0,0,1);
\node[green!80!black] at ($(240:4.5)+(0,0,1.2)$) {z};
\draw[red!80!black,->] (240:4.5) -- ++ (240+90:1);
\node[red!80!black] at ($(240:4.5)+(240+90:1.3)$) {x};
\fill[black!50!gray,draw=black!50!black] (240:4.5) circle (0.05cm);
\foreach \d in {0,60,120,180,240,300}
{
\draw[thick, black,->] (\d:4.5) -- ++(1,1,1);
}
\end{tikzpicture}
\end{document}
但我得到的所有向量都指向同一个方向。我该如何修复它以使其与第一个图相似?还有我如何像第一个图一样添加角度 \alpha 和 \beta?
答案1
您可以使用tikz-3dplot
在这里使用。它允许你切换到旋转坐标。我的看法是,你真的想平行移动一个旋转向量,如您的屏幕截图所示。切线的平行传输会容易得多,您只需要使用 xy 平面。(如果这是您想要的,请告诉我。)
需要平行移动的向量的旋转角度存储在“函数”alpha
和中beta
,可以随意调整,视角也可以。
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{00}%<- set view angles
\begin{tikzpicture}[>=stealth,line cap=round,
tdplot_main_coords,%<- install 3d view
declare function={R=4;alpha=-40;beta=-50;}%<- radius of the circle and angles
]
\begin{scope}[canvas is xy plane at z=0]
\draw[semithick] (0,0) circle[radius=R];
\draw[thick,->,blue] (-1.5,-R) -- ++ (3,0) node[right]{$t$};
\draw (1,-R) arc[start angle=0,end angle=alpha,radius=1];
\path foreach \X in {0,...,5}
{(-90+\X*60:R) coordinate (p\X)}; % points along the circle
\end{scope}
% rotated plane at p0
\tdplotsetrotatedcoords{alpha}{0}{0}
\begin{scope}[tdplot_rotated_coords,canvas is xz plane at y=0,shift={(p0)}]
\draw (0,0) rectangle ++ ((90+beta:{1/abs(cos(alpha))}) (1,0) node[right]{$\alpha$};
\draw[thick,->,red] (-90+beta:{1/abs(cos(alpha))})
-- ++ (90+beta:{2/abs(cos(alpha))});
\draw[->] (0,-1) -- (0,1) node[above]{$z$};
\draw (0,0.5) arc[start angle=90,end angle=90+beta,radius=0.5]
node[midway,above right] {$\beta$};
\end{scope}
% other planes
\foreach \X in {1,...,5}
{\tdplotsetrotatedcoords{alpha}{0}{\X*60}
\begin{scope}[tdplot_rotated_coords,canvas is xz plane at y=0,shift={(p\X)}]
\draw[thick,->,red] (-90+beta:{1/abs(cos(alpha))})
-- ++ (90+beta:{2/abs(cos(alpha))});
\end{scope}}
\end{tikzpicture}
\end{document}