3d 无人机和欧拉角

3d 无人机和欧拉角

我想使用 tikz 绘制我上传的图片。我无法指示角度并创建与图片相似的东西。在此处输入图片描述

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}

\fill[black!50] (2.5,1) ellipse (1 and 0.5);

%\fill[black!50][rotate=-30] (-2.5,1) ellipse (1.5 and 0.5);

\fill[black!50] (-2.5,1) ellipse (1 and 0.5);

\fill[black!50] (2.5,-1) ellipse (1 and 0.5);

\fill[black!50] (-2.5,-1) ellipse (1 and 0.5);

\fill[black!50] (-0,-0) ellipse (1.5 and 0.5);

\draw[black, ultra thick] (1.,.4) -- (2.5,1);

\draw[black, ultra thick] (-1.,.4) -- (-2.5,1);

\draw[black, ultra thick] (1.,-.4) -- (2.5,-1);

\draw[black, ultra thick] (-1.,-.4) -- (-2.5,-1);


\end{tikzpicture}
\end{document}

答案1

3dTikZ 可能不是 3D 图表的最佳工具,但它以和库的形式提供支持perspective

此外,还有tikz-3dplottikz-3dtools

我不确定你的蓝色坐标系是如何工作的,以及它在世界上的位置。蓝色轴是相对于主红色虚线轴定义的,这样可以轻松地在它们之间绘制弧线。该angles库仅适用于帆布坐标系(有单位的坐标系)始终是二维的。

代码

\documentclass[tikz]{standalone}
%\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{3d, arrows.meta, calc, quotes}
\begin{document}
\begin{tikzpicture}[
  x = ( 20:-2cm), y = (-30: 2cm), z = ( 80: 1.6cm),
  > = Triangle]
\draw coordinate (O) (0,0,-.05) ellipse [radius=.2];

\foreach \xy/\yx in {x/y, y/x} {
  \fill[white] (xyz cs: \xy = -1, \yx = -.05) -- (xyz cs: \xy =  1, \yx=-.05)
            -- (xyz cs: \xy =  1, \yx =  .05) -- (xyz cs: \xy = -1, \yx= .05) -- cycle;
  \foreach \lmr in {-.05, 0, .05}
    \draw[gray] (xyz cs: \xy=-1, \yx = \lmr) -- (xyz cs: \xy=1, \yx=\lmr);
  \draw[fill=white, radius=.15] (xyz cs: \xy = -1) ellipse[]
                                (xyz cs: \xy =  1) ellipse[];
}
\draw[fill=white] (O) ellipse [radius=.2];

\foreach \xyz/\Label/\Ang in {% \Ang needs to start with a ,
  x/left/ {, longitude = 70},
  y/right/{, longitude =-20},
  z/above/{, longitude = 70, latitude=70}%
} {
  \draw[->, densely dashed, red] (0, 0, 0) -- ++(xyz cs: \xyz= 1.5)
    coordinate (ax-\xyz) node[\Label] {$\xyz$};
  \draw[blue, ->]
     (0, 0, 0) -- (xyz spherical cs: radius = 1.5,/tikz/style/.expanded=\Ang)
      coordinate (ax-\xyz') node[\Label] {$\xyz$};
}

\draw[canvas is xy plane at z=0]
  (0, 1) arc[start angle=90, delta angle=20, radius=1]
  node[midway, below right] {$\varphi$};
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

相关内容