如何使用 tikz 绘制这个?

如何使用 tikz 绘制这个?

我正在尝试使用 tikz 或 pstricks 来说明类似的事情。

我几乎已经得到了我想要的东西,它本质上是一个由矢量跨越的三维对象。

我想添加看起来像下面图片的面,并且我想知道如何添加角度 theta。

谢谢

\documentclass{article}

\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}



\begin{document}
\begin{preview}

\tdplotsetmaincoords{50}{110}
\begin{tikzpicture}[tdplot_main_coords]
\draw[thick,->, dashed, gray] (0,0,0) -- (3,0,0) node[anchor=north east]{$x$};
\draw[thick,->, dashed] (0,0,0) -- (0,3,0) node[anchor=north west]{$y$};
\draw[thick,->, dashed] (0,0,0) -- (0,0,3) node[anchor=south]{$z$};
\pgfmathsetmacro{\bx}{-1}
\pgfmathsetmacro{\by}{3}
\pgfmathsetmacro{\bz}{0}
\pgfmathsetmacro{\ax}{1}
\pgfmathsetmacro{\ay}{4}
\pgfmathsetmacro{\az}{0}
\pgfmathsetmacro{\cx}{3}
\pgfmathsetmacro{\cy}{5}
\pgfmathsetmacro{\cz}{5}


\tdplotcrossprod(\ax,\ay,\az)(\bx,\by,\bz)
\draw[->,red] (0,0,0) -- (\ax,\ay,\az) node[anchor=west]{$\vec{A}=[\ax, \ay, \az]$};
\draw[dashed, ->,red] (\bx,\by,\bz) -- (\bx+\ax,\by+\ay,\bz+\az) node[anchor=west]{ };

\draw[->,green!50!black] (0,0,0) -- (\bx,\by,\bz) node[anchor=north west]{$\vec{B}=[\bx,\by,\bz]$};
\draw[dashed, ->,brown!50!black] (0,0,0) -- (\cx,\cy,\cz) node[anchor=south west]{$\vec{C}=[\cx,\cy,\cz]$};


\draw[->,green!50!black] (0,0,0) -- (\bx,\by,\bz) node[anchor=north west]{$\vec{B}=[\bx,\by,\bz]$};


\draw[dashed, ->,gray,fill=blue, opacity=.14] (0,0,0) -- (\ax,\ay,\az) -- (\ax+\bx,\ay+\by,\az+\bz) -- (\bx,\by,\bz) -- (0,0,0);


\draw[->,blue] (0,0,0) -- (\tdplotresx,\tdplotresy,\tdplotresz) node[anchor=south east]{$\vec{A}\times\vec{B}$};
%\draw[dashed,blue] (0,0,0) -- (\tdplotresx,\tdplotresy,0) -- (\tdplotresx,\tdplotresy,\tdplotresz);
\end{tikzpicture}


\end{preview}
\end{document}

在此处输入图片描述

任何帮助深表感谢

答案1

我知道回答得有点晚了。我只是在练习 Tikz。

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usepackage{amsmath}
\usetikzlibrary{decorations.pathreplacing,calligraphy,shapes.multipart}

\begin{document}
\tdplotsetmaincoords{60}{85}
\begin{tikzpicture}[tdplot_main_coords]

% vectors coordinates
\pgfmathsetmacro{\bx}{-1}
\pgfmathsetmacro{\by}{3}
\pgfmathsetmacro{\bz}{0}
\pgfmathsetmacro{\ax}{1}
\pgfmathsetmacro{\ay}{4}
\pgfmathsetmacro{\az}{0}
\pgfmathsetmacro{\cx}{1}
\pgfmathsetmacro{\cy}{3}
\pgfmathsetmacro{\cz}{5}

% origin and other vertexes
\coordinate (O) at (0,0,0);
\coordinate (A) at (\ax,\ay,\az);
\coordinate (B) at (\bx,\by,\bz);
\coordinate (C) at (\cx,\cy,\cz);
\coordinate (AB) at (\ax+\bx,\ay+\by,\az+\bz);
\coordinate (AC) at (\ax+\cx,\ay+\cy,\az+\cz);
\coordinate (BC) at (\bx+\cx,\by+\cy,\bz+\cz);
\coordinate (ABC) at (\ax+\bx+\cx,\ay+\by+\cy,\az+\bz+\cz);

% axes
\begin{scope}[every path/.style={thick,->, dashed, gray}]
    \draw (O) -- (3,0,0) node[anchor=north east]{$x$};
    \draw (O) -- (0,3,0) node[anchor=west]{$y$};
    \draw (O) -- (0,0,3) node[anchor=south west]{$z$};
\end{scope}

% vectors
\draw[->,ultra thick,red] (O) -- (A) node[anchor=north west]{$\vec{A}=[\ax, \ay, \az]$};
\draw[dashed,->,red] (B) -- (AB);
\draw[->,ultra thick,green!50!black] (O) -- (B) node[anchor=south west]{$\vec{B}=[\bx,\by,\bz]$};
\draw[dashed,->,green!50!black] (A) -- (AB);
\draw[->,ultra thick,brown!50!black] (O) -- (C) node[anchor=south]{$\vec{C}=[\cx,\cy,\cz]$};

% angle theta
\tdplotgetpolarcoords{\cx}{\cy}{\cz}
\tdplotsetthetaplanecoords{\tdplotresphi}
\tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{1}{0}%
{\tdplotrestheta}{anchor=south}{$\theta$}

% faces
\begin{scope}[every path/.style={dashed, ->,draw=gray,fill=blue}]
    \draw[opacity=.10] (O) -- (A) -- (AB) -- (B) -- cycle;
    \draw[opacity=.20] (O) -- (C) -- (BC) -- (B) -- cycle;
    \draw[opacity=.15] (O) -- (A) -- (AC) -- (C) -- cycle;
    \draw[opacity=.01] (C) -- (AC) -- (ABC) -- (BC) -- cycle;
    \draw[opacity=.20] (A) -- (AC) -- (ABC) -- (AB) -- cycle;
    \draw[opacity=.10] (B) -- (BC) -- (ABC) -- (AB) -- cycle;
\end{scope}

% vector product
\tdplotcrossprod(\ax,\ay,\az)(\bx,\by,\bz)
\draw[->,blue] (O) -- (\tdplotresx,\tdplotresy,\tdplotresz) node[anchor=south east]{$\vec{A}\times\vec{B}$};

% projection of C onto z-axis
\draw[dashed] (0,0,\cz) -- (C);
\draw (0.08*\cx,0.08*\cy,\cz) -- +(0,0,-0.35) -- +(-0.08*\cx,-0.08*\cy,-0.35);

% calligraphic brace
\draw[decoration={calligraphic brace,amplitude=8pt,raise=4pt},decorate] (O) -- node[left=12pt] {$h$} (0,0,\cz);

% annotation
\draw (0,6,0) -- (2,8,0) node[anchor=north,align=center]{Area of base \\ $\lVert\vec{A}\times\vec{B}\rVert$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容