使用 tike-3dplot 绘制方向余弦

使用 tike-3dplot 绘制方向余弦

我正在尝试使用 tikz-3dplot 重现以下图像。 在此处输入图片描述

我需要有关矢量箭头、矢量 v 和单位矢量 i、j 和 k 所成角度的帮助。

以下是我目前所掌握的信息:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\begin{document}
    \tdplotsetmaincoords{60}{110}
    \begin{center}
        \begin{tikzpicture}[>=latex,tdplot_main_coords,font=\footnotesize,scale=1.5]
            \draw[thick,->] (0,0,0) -- (2,0,0) node[anchor=north east]{$x$};
            \draw[thick,->] (0,0,0) -- (0,2,0) node[anchor=north west]{$y$};
            \draw[thick,->] (0,0,0) -- (0,0,2) node[anchor=south]{$z$};
            \draw[thick,->,color=red,opacity=0.5] (0,0,0) -- (2.5,2.5,3) node[ right] {$\vec{v}$};
        \end{tikzpicture}
    \end{center}
\end{document}

答案1

干得好:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta,angles,quotes}
\begin{document}
    \tdplotsetmaincoords{60}{110}
    \begin{center}
        \begin{tikzpicture}[>=latex,tdplot_main_coords,font=\footnotesize,scale=1.5]
            \draw[thick,->] (0,0,0)coordinate (O) -- (3,0,0) coordinate (X)
                    node[anchor=north east]{$x$};
            \draw[thick,->] (0,0,0) -- (0,3,0) coordinate (Y) node[anchor=north
                    west]{$y$};
            \draw[thick,->] (0,0,0) -- (0,0,3) coordinate (Z) node[anchor=south]{$z$};
            \draw[thick,->,color=red,opacity=0.5] (0,0,0) -- (2.5,2.5,3) coordinate (V)
                    node[ right] {$\vec{v}$};
            \draw[dashed,magenta!50] (2.5,2.5,3) -- (2.5,2.5,0) -- (0,0,0);
            \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
                    (2,0,0)node [right=1ex] {$\mathbf{i}$};
            \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
                    (0,2,0)node [below] {$\mathbf{j}$};
            \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
                    (0,0,2)node [left] {$\mathbf{k}$};
            \path pic[draw, angle radius=5mm,"$\alpha$",angle
                    eccentricity=1,anchor=north east,inner sep=5pt] {angle
                     = X--O--V};
            \path pic[draw, angle radius=7mm,"$\beta$",angle
                    eccentricity=1.3,] {angle
                     = Y--O--V};
            \path pic[draw, angle radius=3mm,"$\gamma$",angle
                    eccentricity=1.5] {angle
                     = V--O--Z};
        \end{tikzpicture}
    \end{center}
\end{document}

在此处输入图片描述

如果您想要i j k黑色,请添加text=black到节点选项。

相关内容